[英]How to get response from wsdl with complex Type using php
Help me please. 请帮帮我。 I have wsdl with complex type example like this : 我有这样的wsdl与复杂类型的示例:
<WL5G3N0:definitions name="commandModificationiSiska">
<xsd:complexType name="Input">
<xsd:sequence>
<xsd:element minOccurs="0" name="dn" nillable="true" type="xsd:string"/>
<xsd:element name="ptOffer" nillable="true" type="tns:ptOffer"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ptOffer">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="array" nillable="true" type="tns:array"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="array">
<xsd:sequence>
<xsd:element name="itemTyp" nillable="true" type="xsd:string"/>
<xsd:element name="itemCode" nillable="true" type="xsd:string"/>
<xsd:element name="itemRefPack" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
actually i have found on try to follow one solution in this link . 实际上,我发现尝试遵循此链接中的一种解决方案。 In that link is similar with my problem but still not working. 在那个链接是类似于我的问题,但仍然无法正常工作。
and this is my php script i write in 这是我写的我的PHP脚本
error_reporting(E_ALL);
ini_set('display_errors', 1);
$param = new StdClass();
$param->array = new StdClass();
$param->input = new StdClass();
$param->input->dn = "XX2042XXXX";
$param->array->itemTyp = "2";
$param->array->itemcode = "AUTOCON2";
$param->array->itemRefPack = "";
$wsdl_file = "test.wsdl";
$client = new SoapClient($wsdl_file,array("trace"=> 1,"exceptions" => 0,"cache_wsdl" => 0));
print_r($client->commandModificationiSiska($param));
echo "<br/>================<br/>";
echo "<p>Request :".htmlspecialchars($client->__getLastRequest()) ."</p>";
echo "<p>Response:".htmlspecialchars($client->__getLastResponse())."</p>";
Maybe someplace had resolved for this problem and can help me in here .. 也许某个地方已经解决了这个问题,可以在这里帮助我..
Problems solved. 问题解决了。 Very simple solution. 非常简单的解决方案。 Input has separated two parameter : 输入分隔了两个参数:
dn dn
ptoffer to
"ptoffer" separated in 3 input parameter was named with "array". 用3个输入参数分隔的“ ptoffer”用“ array”命名。 "array" have 3 parameter , there are itemCode,itemtyp,itemrefpack. “数组”有3个参数,分别是itemCode,itemtyp,itemrefpack。 Thats the point. 这才是重点。
i just have to do this for get respone from that wsdl file. 我只需要这样做,即可从该wsdl文件获得响应。
$client = new SoapClient($wsdl_file,array("trace"=> 1,"exceptions" => 0,"cache_wsdl" => 0)); $ client = new SoapClient($ wsdl_file,array(“ trace” => 1,“ exceptions” => 0,“ cache_wsdl” => 0));
print_r( $client->commandModificationiSiska(array(
"dn" => "1222XXX",
"ptOffer" => array('array' => array("itemTyp" => 2,
"itemCode" => "blabla",
"itemRefPack" => ""
))
)));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.