为什么我的SOAP调用不能与PHP一起工作?

为什么我的SOAP调用不能与PHP一起工作?,php,soap,soapui,Php,Soap,Soapui,我正在尝试调用SOAP函数。我在soapui上测试了这个函数,它运行良好。它给了我一个成功的回应。但是,当我尝试使用PHP调用该函数时,会出现以下错误: SoapFault异常:[服务器]中的内部错误 /home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php:24 堆栈跟踪:#0 /home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php(24): SoapC

我正在尝试调用SOAP函数。我在soapui上测试了这个函数,它运行良好。它给了我一个成功的回应。但是,当我尝试使用PHP调用该函数时,会出现以下错误:

SoapFault异常:[服务器]中的内部错误 /home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php:24 堆栈跟踪:#0 /home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php(24): SoapClient->uuSOAPCall('track',Array)#1{main}

我什么都试过了,但不知道我做错了什么。这是我的密码:

$username = 'XXXXXXXX';
$pro = '90986629';

        $wsdl = "https://unus.site/V2/Dashboard/includes/ShipmentTracking.wsdl";

        $request = array(
            'trackingNumber' => $pro,
            'userId ' => $username
        );

        $client = new SoapClient($wsdl);

        try
        {

            $result = $client->__soapCall("track", array(
                $request
            ));

            print_r($result);

        }
        catch(SoapFault $ex)
        {
            $ex->getMessage();
            echo $ex;

        }
下面是我的SOAP UI测试的快照:


轨迹是一个
复杂类型
,因此您需要向其传递一个对象,而不是数组:

<element name="track">
<complexType>
 <sequence>
  <element name="trackingNumber" nillable="true" type="xsd:string"/>
  <element name="deliveryNotificationRequested" nillable="true" type="xsd:string"/>
  <element name="deliveryNotificationEmail1" nillable="true" type="xsd:string"/>
  <element name="deliveryNotificationEmail2" nillable="true" type="xsd:string"/>
  <element name="userId" nillable="true" type="xsd:string"/>
 </sequence>
</complexType>

$request = new StdClass();
$request->trackingNumber = '12345';
$request->userId = '222'; 

$client->track($request); 

$request=新StdClass();
$request->trackingNumber='12345';
$request->userId='222';
$client->track($request);

不幸的是,它仍然给了我相同的错误。您确定
请求
属性包含
字符串
?另外,您确定错误完全相同吗?错误不应提及
数组
,因为您不再传递一个…或者不应提及,因为我正在使用字符串作为参数。以下是我尝试此操作时遇到的错误:SoapFault异常:[Server]在/home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php中出现内部错误:21堆栈跟踪:#0/home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php(21):SoapClient->调用('track',Array)#1/home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking/npmeTracking.php(21):SoapClient->track(Object(stdClass))#2{main}使用
trace
选项,
$client=newsoapclient($wsdl,array('trace'=>1,'exceptions'=>0));
在catch块中查看最后一条响应消息
$client->\uu getlastress()
;这是我现在得到的响应:SoapFault对象([message:protected]=>内部错误[string:Exception:private]=>[code:protected]=>0[file:protected]=>/home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php[line:protected]=>22[trace:Exception:private]=>Array([0]=>Array]=>/home/bookweeb/unus.site/V2/Dashboard/includes/npmeTracking.php[line]=>22[function]=>\uu调用[class]=>SoapClient[type]=>->->[args]=>Array([0]=>track[1]=>Array([0]=>Array([trackingNumber]=>90986629[userId]=>XXXX)))[1]=>