Send other attributes with xsi:type attribute in Soap Request PHP

怎甘沉沦 提交于 2019-12-11 13:55:16

问题


I am trying to set xsi:type and some attributes in the same request tag and send a php soap request. But, I am getting the following unmarshalling error. Can someone suggest a way to overcome this issue?

Soap Exception

Fatal error: Uncaught SoapFault exception: [soap:Client] Unmarshalling Error: unexpected element (uri:"", local:"_"). Expected elements are <{}iId>,<{}pId> in C:\wamp\www...

Soap Request:

<request xsi:type="ns1:PCType" xactionid="transactionid"> <pId>pId</pId> <iId>iId</iId> </request>

Code:

$request['_']['pId'] = 'pId';
$request['_']['iId'] = 'iId';

$request['xactionId'] = 'transactionid'; // it works when i comment this line :(

$request = new SoapVar($request, SOAP_ENC_OBJECT, "ns1:PCType", "" );
$r['request'] = $request;

$this->soapEnvelope = $r;

$apiResponse = $this->soapClient->__soapCall($this->apiFunc, $this->soapEnvelope, $this->soapHeader, array());

来源:https://stackoverflow.com/questions/28872224/send-other-attributes-with-xsitype-attribute-in-soap-request-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!