SOAP请求500错误

时间:2013-10-03 18:15:28

标签: php soap nusoap

我正在使用NuSOAP而我正在尝试提出请求,但总是收到500错误:

<?php
require_once('../lib/nusoap.php');

$c = new soapclient('http://example.com/index.asmx?WSDL');

$clientVAT = $c->call('GetClient',
              array(
                'empresa' => '*****',
                'password' => '******',
                'nif' => '*******',
                ));

echo "clientVAT $clientVAT.";

?> 

这不足以从服务器获得响应吗?

1 个答案:

答案 0 :(得分:0)

在你的wsdl中,你有一个带有2个级别的complexType

<s:element name="GetClientesNif">
    <s:complexType>
        <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="empresa" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
            <s:element minOccurs="0" maxOccurs="1" name="nif" type="s:string"/>
        </s:sequence>
    </s:complexType>
</s:element>

这就是你需要发送一个2级数组的请求的原因:

试试这个:

$myArray[] = array(
                'empresa' => '*****',
                'password' => '******',
                'nif' => '*******',
                );

$clientVAT = $c->call('GetClientesNif', $myArray);
相关问题