function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
eyewelleyewell 

How to work with a WSDL that returns an array of anyType

Hello,

I need to figure out how to adjust my wsdl2apex generated class, or my apex code, so that I can interact with a web service that returns an array of anyType objects.

The wsdl2apex converter didn't like the occurrence of anyType, as a type in the WSDL file. So just to get the WSDL imported, I changed xnyType to "XAnyType", which allowed me to proceed with the import and generate the class.

No when I try to access that webservice, I get an error message that says the following

Code:
20081007014451.061:Class.EDY2007.GetCompanyDetails_Controller.getAccountDetail: 
line 57, column 13: **getAccountDetail(): GetCompanyInfo() Failed:
System.CalloutException: Web service callout failed: Unable to parse callout
response. Apex type not found for element
http://<URL deleted>/.../Company/GetCompanyInfo=anyType

Here is the relevant parts of the WSDL for the web services response:
Code:
...
<s:complexType name="ArrayOfAnyType">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="anyType" nillable="true"/>
        </s:sequence>
      </s:complexType>

...
<s:element name="GetCompanyInfoResponse">
  <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="GetCompanyInfoResult"
type="tns:ArrayOfAnyType"/>
</s:sequence>
</s:complexType>
</s:element>

...
<wsdl:message name="GetCompanyInfoSoapOut">
<wsdl:part name="parameters" element="tns:GetCompanyInfoResponse"/>
</wsdl:message>

...

<wsdl:portType name="GetCompanyInfoSoap">
<wsdl:operation name="GetCompanyInfo">
<wsdl:input message="tns:GetCompanyInfoSoapIn"/>
<wsdl:output message="tns:GetCompanyInfoSoapOut"/>
</wsdl:operation>
</wsdl:portType>

I imagine I can create a new class in my Apex Classes so i can handle anyType records...
Can anyone point me in the right direction?

Thanks!

Erik