我制作一个肥皂服务器和PHP,我可以完美地访问WSDL,但是当我使用soapclient测试时,我提出了这个错误:
SOAP-ERROR: Encoding: object hasn't 'ID' property in
这里是客户的定义:
$client = new SoapClient('http://testwebservices.binbit.com/smart_ph/process_mo.php?wsdl',array('trace' => 1));
定义stdClass
元素:
$data = new stdClass();
$data->userID->ID = '6235412410';
$data->userID->type = 0;
$data->spID = '13225124';
$data->productID = '212233223';
$data->serviceID = '145612354';
$data->serviceList = '552143256';
$data->updateType = 1;
$data->updateTime = '20140812346509';
$data->effectiveTime = '20140812346509';
$data->expiryTime = '5678942';
$data->notifyAttr[] = array('shortCode' => '42356');
在这里采取行动:
$action = $client->syncOrderRelation($data);
在Xml中存在一个ID元素:
<xsd:complexType name="UserID">
<xsd:all>
<xsd:element name="ID" type="xsd:string"/>
<xsd:element name="type" type="xsd:int"/>
</xsd:all>
</xsd:complexType>
我不明白为什么会这样。
谢谢!
答案 0 :(得分:0)
最后我找到了解决方案。
我必须单独执行UserID:
$data = new stdClass();
$data->userID->ID = '6235412410';
$data->userID->type = 0;
其余的个别变量:
$spID = '13225124';
$productID = '212233223';
$serviceID = '145612354';
$serviceList = '552143256';
...
$action = $client->syncOrderRelation($data,$spID,$productID,...);