如何使用NuSOAP创建在WSDL文档中定义的PHP对象

时间:2015-10-30 11:14:35

标签: php nusoap

我正在尝试使用网络服务(用.NET编写,FWIW)。

我尝试调用的方法将var cookie = new HttpCookie(name) { Value = val, HttpOnly = false // #DEV search cookies can be modified by JS }; HttpContext.Current.Response.Cookies.Add(cookie); 个对象作为参数。所述对象在WSDL中定义如下:

WSCredentials

我尝试用数组伪装它:

<wsdl:definitions targetNamespace="http://services.example.com/foo/bar">
[...]
<wsdl:types>
  <s:schema elementFormDefault="qualified" targetNamespace="http://services.example.com/foo/bar">
[...]
    <s:complexType name="WSCredentials">
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="Username" type="s:string"/>
        <s:element minOccurs="0" maxOccurs="1" name="Client" type="s:string"/>
        <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string"/>
      </s:sequence>
    </s:complexType>
[...]

......也没有钥匙:

$CREDENTIALS = array(
    'Username' => $WSCREDENTIALS_USERNAME,
    'Client'   => $WSCREDENTIALS_CLIENT,
    'Password' => $WSCREDENTIALS_PASSWORD,
);

这些都不奏效。当我调用带有此参数的方法时,代码如下:

$CREDENTIALS = array(
    $WSCREDENTIALS_USERNAME,
    $WSCREDENTIALS_CLIENT,
    $WSCREDENTIALS_PASSWORD,
);

...我刚收到回复状态400:

$result = $client->call('SomeMethod', array($otherParameter, $CREDENTIALS));

是否有一些特殊方法来实例化HTTP/1.1 400 Bad Request Server: Microsoft-IIS/8.5 X-Powered-By: ASP.NET Date: Fri, 30 Oct 2015 11:07:08 GMT Content-Length: 0 对象?

0 个答案:

没有答案