Search code examples
phpweb-servicessoapwsdl

How to access ComplexType Variables


I got a WSDL, and some variables are sended to me, but I don't know in which way to acces them....

The WSDL part that I need looks like this:

<s:element name="SaveRelation">
   <s:complexType>
      <s:sequence>
         <s:element minOccurs="0" maxOccurs="1" name="persistance" type="tns:Relation"/>
      </s:sequence>
   </s:complexType>
</s:element>

<s:complexType name="Relation">
   <s:sequence>
      <s:element minOccurs="1" maxOccurs="1" name="GUID" type="s1:guid"/>
      <s:element minOccurs="1" maxOccurs="1" name="ParentRelation" nillable="true" type="s1:guid"/>
      <s:element minOccurs="0" maxOccurs="1" name="RelationName" type="s:string"/>
      <s:element minOccurs="1" maxOccurs="1" name="VisitAddress" nillable="true" type="s1:guid"/>
      <s:element minOccurs="1" maxOccurs="1" name="DeliveryAddress" nillable="true" type="s1:guid"/>
      <s:element minOccurs="1" maxOccurs="1" name="Person_1" nillable="true" type="s1:guid"/>
      <s:element minOccurs="1" maxOccurs="1" name="Person_2" nillable="true" type="s1:guid"/>
      <s:element minOccurs="1" maxOccurs="1" name="Person_3" nillable="true" type="s1:guid"/>
      <s:element minOccurs="1" maxOccurs="1" name="Person_4" nillable="true" type="s1:guid"/>
      <s:element minOccurs="0" maxOccurs="1" name="Country" type="s:string"/>
      <s:element minOccurs="0" maxOccurs="1" name="ChamberOfCommerceNumber" type="s:string"/>
      <s:element minOccurs="0" maxOccurs="1" name="VatNumber" type="s:string"/>
      <s:element minOccurs="0" maxOccurs="1" name="Fax" type="s:string"/>
      <s:element minOccurs="0" maxOccurs="1" name="Telephone" type="s:string"/>
      <s:element minOccurs="0" maxOccurs="1" name="InternetAddress" type="s:string"/>
      <s:element minOccurs="0" maxOccurs="1" name="E_mail" type="s:string"/>
      <s:element minOccurs="1" maxOccurs="1" name="Obsolete" type="s:boolean"/>
   </s:sequence>
</s:complexType>

<wsdl:message name="SaveRelationSoapIn">
   <wsdl:part name="parameters" element="tns:SaveRelation"/>
</wsdl:message>

These variables are sended to my server, I need to process them and put them in the database, and then return ok/fail based on succes or failure. I've got everything working, accept for accesing the variables.

I've tried things like $parameters.GUID , $parameters[0][0], $parameters[0].GUID , the 1st returns ArrayGUID, the second return nothing/empty, the third also returns nothing/empty.

So to sum it up, I don't know how to acces the variables in the Relation ComplexType.


Solution

  • Have you tried to var_dump() the response from the service? You should be able to determine how to reach the values if you can see the structure of the response data.