Nate
Nate

Reputation: 7856

SOAP request with complex type in PHP

I would like to make a SOAP request with complex types... I have two different variables:

<!--type: string-->               
        <xsd:type>PC</xsd:type><xsd:property>
<!--type: string-->            

and:

<xsd:deviceId xsi:type="xsd1:LogicalDeviceId" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">           
         <xsd1:id>234</xsd1:id>
</xsd:deviceId>

Anyone has an idea how to create these two variables?

Thanks

Upvotes: 1

Views: 11062

Answers (1)

Sam Huggill
Sam Huggill

Reputation: 3126

You can use the PHP SoapClient to create the complex types, for example:

$deviceId = new SoapVar(array("xsd1:id" => 1234), XSD_ANYTYPE, "xsd1:LogicalDeviceId", "http://www.w3.org/2001/XMLSchema-instance", "deviceId");


$soapClient = new SoapClient("http://yoursoaptarget");
$soapClient->yourSoapMethod($deviceId, <other params);

See more details on SoapVar in the PHP documentation:

http://www.php.net/manual/en/soapvar.soapvar.php

Upvotes: 2

Related Questions