Hello I want to know how to send this array of complex data to a SOAP server (that uses .NET / IIS).
<xs:complexType name="SampleStruct">
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SampleStruct_Array">
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:sequence/>
<xs:attribute ref="soapenc:arrayType" n1:arrayType="ns1:SampleStruct[]"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
Would this code be ok? :
$data1 = new SampleStruct();
$data1->title="Hello world";
$data1->description="This is a sample description.";
$data2 = new SampleStruct();
$data2->title="Hello world 2";
$data2->description="This is a sample description 2.";
$client->__soapCall("sampleFunction", array(
new SoapParam(new SoapVar(array($data1, $data2) , SOAP_ENC_ARRAY,
"SampleStruct_Array", "http://www.w3.org/2001/XMLSchema"),
"theSampleFunctionParamName")
));
Am I doing it ok? I'm not very familiar with Web services...
Thank you
EDITED:
I've got the solution. PHP SOAP extension is more easy to use that I was thinking...
I've just passed the complex data structures as associative arrays with no problem.
Example:
$client->someServerFunction("value1", array(array("title"=>"title1", "description"=>"description1"), array("title"=>"title2", "description"=>"description2")));