请帮帮我。我有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>
实际上,我发现尝试在 this link 中使用一个解决方案。在那个链接与我的问题类似,但仍然无法正常工作。
这是我用
编写的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>";
也许某个地方已经解决了这个问题,可以帮助我...
答案 0 :(得分:0)
问题解决了。 很简单的解决方案 输入分隔了两个参数:
DN
ptoffer
在3个输入参数中分隔的“ptoffer”以“array”命名。 “array”有3个参数,有itemCode,itemtyp,itemrefpack。这就是重点。
我只需要从wsdl文件中获取响应。
$ client = new SoapClient($ wsdl_file,array(“trace”=&gt; 1,“exceptions”=&gt; 0,“cache_wsdl”=&gt; 0));
print_r( $client->commandModificationiSiska(array(
"dn" => "1222XXX",
"ptOffer" => array('array' => array("itemTyp" => 2,
"itemCode" => "blabla",
"itemRefPack" => ""
))
)));