2

I am working with class code generated from the WSDL into PHP. The piece that is hanging me up is the way the class methods were written so that simple arrays appear to be required to be objects of non-existent classes.

In particular this TFolderArray which should by the docs be a simple array of TFolder objects:

<xsd:complexType name="TFolderArray">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:TFolder[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

The documentation for TFolderArray defines it as an array of TFolder structures. However if such an array is passed to GetOpportunityList() (see below), it throws

Argument 3 passed to Exchange::GetOpportunityList() must be an instance of TFolderArray, array given

If you attempt to instantiate an object of that class you rightly get Class 'TFolderArray' not found.

If you remove the restriction that $FolderArray is an instance of TFolderArray and just pass an array of TFolder objects the functionality is what I would expect.

So did the class rendering software misinterpret the WSDL? Should the type hinting just be 'array' for $FolderArray? Or is there a way I can 'type' the array despite no class existing? Here is the method:

public function GetOpportunityList(TLoginInfo $LoginInfo, $AllRecords, TFolderArray $FolderArray) {
    return $this->__soapCall('GetOpportunityList', array($LoginInfo, $AllRecords, $FolderArray),       array(
            'uri' => 'urn:ExchangeService:Exchange33',
            'soapaction' => ''
           )
      );
  }
neubert
  • 15,947
  • 24
  • 120
  • 212
jerrygarciuh
  • 21,158
  • 26
  • 82
  • 139
  • wich tool do you use to convert wsdl to php? BTW you can try to remove TFolderArray in function definition. – Ivan Buttinoni Jul 01 '12 at 22:02
  • In the end I did remove class hints for the arrays. I used a couple different tools and got similar results. That particular set was rendered by http://www.urdalen.no/wsdl2php/ – jerrygarciuh Jul 02 '12 at 22:54

0 Answers0