Accessing a SOAP Webservice using PHP containing a complexType in the WSDL

renda85

New Member
I want to make a call to a webservice of which I only have the WSDL file. I'll list the important bits from the WSDL file with context sensitive names replaced by general ones:The function I want to call:\[code\]<wsdl:operation name="myFunction"> <wsdl:input message="ns:myFunctionRequest" wsaw:Action="urn:myFunction"/> <wsdl:output message="ns:myFunctionResponse" wsaw:Action="urn:myFunctionResponse"/></wsdl:operation>\[/code\]The description of the function:\[code\]<xs:element name="myFunction"> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="param1" nillable="true" type="somens:MyType"/> <xs:element minOccurs="0" name="param2" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType></xs:element>\[/code\]The description of 'MyType':\[code\]<xs:complexType name="MyType"> <xs:sequence> <xs:element minOccurs="0" name="date1" nillable="true" type="xs:dateTime"/> <xs:element minOccurs="0" name="date2" nillable="true" type="xs:dateTime"/> <xs:element minOccurs="0" name="string1" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="int1" nillable="true" type="xs:int"/> <xs:element minOccurs="0" name="int2" nillable="true" type="xs:int"/> </xs:sequence></xs:complexType>\[/code\]I am thinking of my PHP code looking a bit like this:\[code\]$client = new SOAPClient('my soap URL');$result = $client->setState(array('param0'=>'bla', 'param1'=><undecided>, 'param2'=>'bla');\[/code\]My problem is what to put in the undecided part. Should that be an array that maps names in the complex type to values? Or should it be a class that I define myself with field of the corresponding types? I don't have a good testing ground to try this out at this moment and I would like to be able to move on before I do have it available.I saw a lot of SOAP related questions unanswered, so I hope I will get lucky :). If I happen to find out myself, I will of course share my results.Thanks in advance!
 
Back
Top