标签: soap-client

函数执行期间的SOAP客户端超时

我需要使用SOAP从数据库中检索一些数据.我不是一个经验丰富的PHP程序员,这就是我需要一些帮助的原因.提供webservice(WSDL)的公司给了我登录信息和svc和wsdl文件的链接.他们还给了我一个如何连接C#的例子:

var proxy = new ChannelFactory<ServiceReferenceWCF.IWebService2>("custom");
            proxy.Credentials.UserName.UserName = login;
            proxy.Credentials.UserName.Password = pass;
            var result = proxy.CreateChannel();
            var logged_in = result.loggedIn();
Run Code Online (Sandbox Code Playgroud)

这是我的PHP代码:

$wsdl_proto = 'https';
$wsdl_host = 'their_wsdl_host';
$wsdl_host_path = 'their_wsdl_path';
$namespace_proto = 'https';
$namespace_host = 'their_namespace_host';
$namespace_path = 'their_namespace_path';
$location = $namespace_proto.'://'.$namespace_host.$namespace_path;
$wsdl_url = $wsdl_proto.'://'.$wsdl_host.$wsdl_host_path;
$connection = new SoapClient($wsdl_url, array('location' => $location, 'soap_version' => SOAP_1_1, 'connection_timeout'=> 600,
    'proxy_login' => "my_login", 'proxy_password' => "my_password"));
$functions = $connection->__getFunctions();
var_dump($functions);
$logged_in = $connection->loggedIn();
Run Code Online (Sandbox Code Playgroud)

它在loggedIn()函数调用期间挂起.此函数列在$ functions变量中,因此它是有效的.我尝试了服务提供的其他一些功能 - 结果总是一样的:脚本只是冻结了.我的意思是服务没有响应,PHP等待loggedIn()功能完成.超过超时后,我收到一个错误:Error Fetching …

php soap wsdl soap-client

10
推荐指数
1
解决办法
5009
查看次数

如何更改Soap标头消息

我有肥皂请求发送到该服务.在发送之前我想编辑Soap标头

<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
Run Code Online (Sandbox Code Playgroud)

这是我希望传递值为mustUnderstand0而不是1 的标题之一.因为我将值传递为1时会出现一个异常.我得到的值为1的异常是:

org.springframework.ws.soap.client.SoapFaultClientException: One or more mandatory SOAP header blocks not understood
Run Code Online (Sandbox Code Playgroud)

我已经通过将mustUnderstand值传递为0来检查Soap UI 并且它有效.现在我想从我的客户端发送同样的东西.

我试图在应用程序conext bean定义xml文件中添加参数,但没有按照下面的方法工作

<property name="securementmustUnderstand"><value>false</value></property>
Run Code Online (Sandbox Code Playgroud)

请让我知道如何mustUnderstand在我的客户端更改参数.

完整的bean定义如下:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="reg" class="com.service.RegConsServiceImpl">
        <property name="regWebServiceTemplate" ref="regWebServiceTemplate"/>
    </bean>
    <bean id="regWebServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
        <constructor-arg ref="messageFactory"/>
        <property name="marshaller" ref="marshaller"/>
        <property name="unmarshaller" ref="unmarshaller"/>
        <property name="interceptors">          
            <list>
                <ref bean="wsRegClientSecurityInterceptor"/>
            </list>
        </property> 
    </bean>

    <bean id="wsRegClientSecurityInterceptor" class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
        <property name="securementmustUnderstand">
            <value>false</value>
        </property>
        <property name="securementActions" value="UsernameToken" />
        <property name="securementPasswordType" value="PasswordText"/>
        <property name="securementPassword">
            <value>${registration.ws.password}</value> …
Run Code Online (Sandbox Code Playgroud)

spring soap spring-ws soapui soap-client

9
推荐指数
0
解决办法
2544
查看次数

两个不同soap版本的系统属性"javax.xml.soap.MessageFactory"

我需要与我的应用程序中的两个Web服务进行通信.对于一个web服务,我需要使用soap1_1版本,而另一个soap版本是soap1_2.在这种情况下,应该为系统属性"javax.xml.soap.MessageFactory"设置的值是什么

客户1:

public class SoapClient1 {


protected static Logger _logger = Logger.getLogger ("TEST");
private static Long retryDelay = null;


public String sendSoapMessage (String xml) throws Exception {

    SOAPMessage resp  = null;
    String response = null;
    String endpoint = "http:xxxx";



    System.setProperty("javax.xml.soap.MessageFactory","com.sun.xml.internal.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl");
    SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection soapConnection = connectionFactory.createConnection();

    long start = System.currentTimeMillis();
    long end = System.currentTimeMillis();

    //URL endPoint = new URL(endpoint);

    //setting connection time out and read timeout

    URL endPoint = new URL (null, endpoint, new URLStreamHandler () {
        @Override …
Run Code Online (Sandbox Code Playgroud)

java web-services soap-client system-properties

9
推荐指数
1
解决办法
5324
查看次数

NPM SOAP包 - 客户端是单身人士吗?

我正在使用这个npm包:https://www.npmjs.com/package/soap

我在文档中找不到答案,因为我想知道SOAP客户端的最佳实践是创建单个客户端作为启动并用于所有请求(类似于数据库客户端),还是为每个请求创建一个新客户端.

soap soap-client node.js

9
推荐指数
1
解决办法
319
查看次数

使用PHP soap函数的自定义标题

我在使用自定义soap标头与PHP5一起工作时遇到问题.请有人指导我吗

我需要的是这样的

<SOAP-ENV:Header>
  <USER>myusername</USER>
  <PASSWORD>mypassword</PASSWORD>
</SOAP-ENV:Header>  
Run Code Online (Sandbox Code Playgroud)

我得到的是:

<SOAP-ENV:Header>
  <ns2:null>
    <USER>myusername</USER>
    <PASSWORD>mypassword</PASSWORD>
  </ns2:null>
</SOAP-ENV:Header> 
Run Code Online (Sandbox Code Playgroud)

我想删除命名空间标记.我用来获得这个的代码是:

class Authstuff {
  public $USER;
  public $PASSWORD;

  public function __construct($user, $pass) {
    $this->USER = $user;
    $this->PASSWORD = $pass;
  }
} 

$auth = new Authstuff('myusername', 'mypassword');
$param = array('Authstuff' => $auth);
$authvalues = new SoapVar($auth,SOAP_ENC_OBJECT);

$header = new SoapHeader('http://soapinterop.org/echoheader/',"null",$authvalues);
Run Code Online (Sandbox Code Playgroud)

Null似乎没有通过..'null'我仍然得到名称空间,如第二个例子..如何排除这个NS ...感谢你的帮助提前..

$headers = array();
$headers[] = new SoapHeader(null, 'USER', $username);
$headers[] = new SoapHeader(null, 'PASSWORD', $password);

$client->__setSoapHeaders($headers);
try {
    $result = $client->getAvailableLicensedDNCount('ASX01');
    print_r($result);
Run Code Online (Sandbox Code Playgroud)

致命错误:SoapHeader :: SoapHeader():参数无效.命名空间无效.在第29行的/usr/home/deepesh/SoapCalls/deepesh7.php中

php soap soap-client

8
推荐指数
2
解决办法
9963
查看次数

Delphi soap响应保存到xml?

如何保存对xml的soap响应?我尝试使用tstringlist,filestream,创建了xml文件,但是我得到了

无法将varinat类型(null)转换为(type(olestr)

我尝试了这个简单的代码.响应不是空的.文件大小40MB.Delphi XE3.

procedure TForm1.HTTPRIO1AfterExecute(const MethodName: string;
SOAPResponse: TStream);
var xml : TStringlist;
begin
 xml := TStringlist.create;
  try
    soapresponse.Position:=0;
    xml.LoadFromStream(SOAPResponse);
    xml.SaveToFile('...file.xml');
 finally
  xml.Free;
 end;
end;
Run Code Online (Sandbox Code Playgroud)

这是问题(空行)?或不 ?

...

- <leiras>
- <![CDATA[ 
*  Socket AM2 for AMD Athlon™ 64FX / 64X2 / 64 and Sempron processors
* ULi M1697

1. Supports FSB 1000MHz (2.0GT/s), Hyper-Transport Technology and AMD Cool 'n' Quiet   Technology
2. Untied Overclocking : During Overclocking, FSB enjoys better margin due to fixed PCIE/ PCI Buses
3. …
Run Code Online (Sandbox Code Playgroud)

delphi soap-client

8
推荐指数
1
解决办法
4974
查看次数

如何通过SOAP API获取magento中自定义属性的值

我试图通过SOAP api获得magento产品的自定义属性的价值.BUt我只能获得标准属性值.我正在尝试下面的代码,但它似乎没有工作.

$user = 'user';
$password = 'pass';
$proxy = new SoapClient('http://asd.com.au/api/v2_soap?wsdl');
$sessionId = $proxy->login($user, $password);

   //method 1 I tried
    $ebayStock = new stdClass();
    $ebayStock->key = 'ebay_available_qty';
    $additionalAttributes['single_data'][] = $ebayStock ;
    $ebay = $proxy->catalogProductInfo($sessionId, $sku,1,$additionalAttributes);
    var_dump($ebay);
Run Code Online (Sandbox Code Playgroud)

//输出

   object(stdClass)[4]
  public 'product_id' => string '3230' (length=4)
  public 'sku' => string 'test101' (length=7)
  public 'set' => string '9' (length=1)
  public 'type' => string 'simple' (length=6)
  public 'categories' => 
    array (size=0)
      empty
  public 'websites' => 
    array (size=1)
      0 => string '1' (length=1)
  public 'created_at' …
Run Code Online (Sandbox Code Playgroud)

php soap soap-client magento

8
推荐指数
1
解决办法
4815
查看次数

Laravel 5中的PHP Soapclient

我想在laravel 5中使用php内置的SoapClient

我尝试直接使用它显示错误说

找不到类'App\Http\Controllers\SoapClient'.

我尝试像这样添加SoapClient别名数组config/app.php

'SoapClient' => SoapClient::class
Run Code Online (Sandbox Code Playgroud)

还是行不通

我该怎么办?

提前致谢...

php soap-client laravel laravel-5

8
推荐指数
1
解决办法
3万
查看次数

SoapVar和SoapParam有什么区别?

在PHP中,我们有SoapVarSoapParam类.我已经困惑了很长时间,因为在php.net上没有相应的文档.

今天我很惊讶地发现这些行将在XML输入中产生完全相同的结果:

$soapVar   = new SoapVar((object) ['Foo' => 'bar'], null, null, null, 'TagName');
$soapParam = new SoapParam((object) ['Foo' => 'bar'], 'TagName');
Run Code Online (Sandbox Code Playgroud)

在大多数SoapClient教程中,每当有人想要设置自定义时,我都会看到SoapParam里面的片段:SoapVarxsi:type

$response = $soapClient->DoSomething(
    new SoapParam(
        new SoapVar(
            (object) ['Foo' => 'bar'],
            null,
            'TypeName'
        ),
        'TagName'
    )
);
Run Code Online (Sandbox Code Playgroud)

这实在是直观的,因为SoapVarSoapParam类的名称不太多发言权.通过更优雅可以实现相同的结果:

$response = $soapClient->DoSomething(
    new SoapVar(
        (object) ['Foo' => 'bar'],
        null,
        'TypeName',
        null,
        'TagName'
    )
);
Run Code Online (Sandbox Code Playgroud)

那么目的是SoapParam什么?它只是更简单的版本SoapVar吗?看起来这两个人很困惑并被误解了很多.是否附加了额外的行为SoapParam

php soap soap-client

8
推荐指数
1
解决办法
1617
查看次数

即使有响应,PHP SoapClient也会返回null

使用PHP SoapClient,我在https://webservices-test.ede.de:9443/ibis/ws/WS_EXT_ELC?wsdl上调用WSDL,然后得到以下xml响应(如下所示$soapclient->__last_response)

<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:ede="http://ede.de/webservices" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><Response action="ELC" requestId="1" version="1.0"><created>2017-09-04T16:04:46.556+02:00</created><StatusInformation>OK</StatusInformation><StatusCode>0</StatusCode><Payload><SalesOrderSimulateConfirmation><Items><Item><ID>10</ID><ProductID>0003062700050</ProductID><Price>2.970</Price><PositionPrice>2.970</PositionPrice><PriceUnit>1</PriceUnit><QuantityUnit>ST</QuantityUnit><QuantityAvailable>1</QuantityAvailable><QuantityProfile>1</QuantityProfile><Currency>EUR</Currency><Services /><Schedules>Geplante Liefertermine:  1 ST in KW 36.2017;</Schedules><Remark /><DangerMaterial /></Item></Items></SalesOrderSimulateConfirmation></Payload></Response></soap:Body></soap:Envelope>
Run Code Online (Sandbox Code Playgroud)

尽管如此,还是要求$soapclient->simulateOrder()回报null.

如何让PHP SoapClient返回一个对象而不是null?

注意:我用于soap调用的xml是通过覆盖手动生成的SoapClient::__doRequest().soap调用的代码如下所示:

$soapClient = new SoapClient('https://webservices-test.ede.de:9443/ibis/ws/WS_EXT_ELC?wsdl', array(
    'cache_wsdl'   => WSDL_CACHE_NONE,
    'trace'        => true,
    'exceptions'   => true,
    'soap_version' => SOAP_1_2,
    'features'     => SOAP_SINGLE_ELEMENT_ARRAYS,
    'login' => '------', // cannot post here for security purposes
    'password' => '-----', // cannot post here for security purposes
    'stream_context' => (
        stream_context_create(array(
            'ssl' => …
Run Code Online (Sandbox Code Playgroud)

php wsdl soap-client

8
推荐指数
1
解决办法
899
查看次数