在SOAP调用中,类stdClass的对象无法转换为字符串

时间:2014-11-20 09:49:53

标签: php soap

我正在创建SOAP导入,并且我将结果作为id和结果代码

接收

我的代码

    $param = new stdClass();

    $param->item = new stdClass();

    $param->item->mainItem      = new stdClass();
    $param->item->mainItem->id  ="12345";

    $param->item->itemCode      ="item_1603";
    $param->item->title         ="TEST 01";
    $param->item->description   ="Description goes here";

    $clientSOAP = new SoapClient($urlWSDL, $options);
    $clientSOAP->__setLocation($loc);   
    $result = $clientSOAP->ImportItem($param);

...

执行显示此错误

捕获致命错误:类stdClass的对象无法转换为字符串

在行

$ result = $ clientSOAP-> ImportItem($ param);

我已经在SOAPUI中测试了,并且很好地测试了这个结果:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
        <ns1:ImportItemResponseMsg 
            xsi:type="ns1:ImportItemResponse" 
            xmlns:ns1="http://item.webservice.host.xxx.com" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <s151:returnCode xmlns:s151="http://webservice.host.xxx.com">0</s151:returnCode>
                <s152:returnMessage xmlns:s152="http://webservice.host.xxx.com"/>
                <itemId>5046</itemId>
        </ns1:ImportItemResponseMsg>
    </soapenv:Body>
    </soapenv:Envelope>

我认为响应是一个对象,但我无法处理它。有什么想法吗?

TIA

0 个答案:

没有答案