title: Accessing a SOAP Webservice using PHP containing a complexType in the WSDL
body: <p>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:</p>
  
  <p>The function I want to call:</p>
  
  <pre><code>&lt;wsdl:operation name="myFunction"&gt;
     &lt;wsdl:input message="ns:myFunctionRequest" wsaw:Action="urn:myFunction"/&gt;
     &lt;wsdl:output message="ns:myFunctionResponse" wsaw:Action="urn:myFunctionResponse"/&gt;
  &lt;/wsdl:operation&gt;
  </code></pre>
  
  <p>The description of the function:</p>
  
  <pre><code>&lt;xs:element name="myFunction"&gt;
     &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
           &lt;xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/&gt;
           &lt;xs:element minOccurs="0" name="param1" nillable="true" type="somens:MyType"/&gt;
           &lt;xs:element minOccurs="0" name="param2" nillable="true" type="xs:string"/&gt;
        &lt;/xs:sequence&gt;
     &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
  </code></pre>
  
  <p>The description of 'MyType':</p>
  
  <pre><code>&lt;xs:complexType name="MyType"&gt;
      &lt;xs:sequence&gt;
          &lt;xs:element minOccurs="0" name="date1" nillable="true" type="xs:dateTime"/&gt;
          &lt;xs:element minOccurs="0" name="date2" nillable="true" type="xs:dateTime"/&gt;
          &lt;xs:element minOccurs="0" name="string1" nillable="true" type="xs:string"/&gt;
          &lt;xs:element minOccurs="0" name="int1" nillable="true" type="xs:int"/&gt;
          &lt;xs:element minOccurs="0" name="int2" nillable="true" type="xs:int"/&gt;
      &lt;/xs:sequence&gt;
  &lt;/xs:complexType&gt;
  </code></pre>
  
  <p>I am thinking of my PHP code looking a bit like this:</p>
  
  <pre><code>$client = new SOAPClient('my soap URL');
  
  $result = $client-&gt;setState(array('param0'=&gt;'bla', 'param1'=&gt;&lt;undecided&gt;, 'param2'=&gt;'bla');
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Thanks in advance!</p>