Say you want this payload:
<ns1:base>
<itemsLine xsi:type="ns2:urn:test">
<name xsi:type="xsd:string">A</name>
<type xsi:type="xsd:string">D</type>
<from xsi:type="xsd:string">C</from>
<fluke xsi:type="xsd:string">D</fluke>
</itemsLine>
<itemsLine xsi:type="ns2:urn:test">
<name xsi:type="xsd:string">E</name>
<type xsi:type="xsd:string">H</type>
<from xsi:type="xsd:string">G</from>
<fluke xsi:type="xsd:string">H</fluke>
</itemsLine>
</ns1:base>
How do you get this XML to be output by the SoapClient?
You can get this exact payload with the following code:
<?php
class itemsLine{
function itemsLine($a, $b, $c, $d)
{
$this->name = $a;
$this->type = $d;
$this->from = $c;
$this->fluke = $d;
}
}
$client = new SoapClient(null, array('location' => "http://localhost:9090/soap.php",
'uri' => "http://test-uri/"));
$item1 = new itemsLine('A', 'B', 'C', 'D');
$item2 = new itemsLine('E', 'F', 'G', 'H');
$var1 = new SoapVar($item1 , SOAP_ENC_OBJECT, "urn:test", "http://soapinterop.org/xsd");
$var2 = new SoapVar($item2 , SOAP_ENC_OBJECT, "urn:test", "http://soapinterop.org/xsd");
$client->base(new SoapParam($var1, "itemsLine"), new SoapParam($var2, "itemsLine"));
?>
No comments:
Post a Comment