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
osama naqiosama naqi 

please help me how to generate apex code from partner wsdl i have got an error

Apex Generation Failed
Unsupported schema type: {http://www.w3.org/2001/XMLSchema}anyType





 
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

As per Salesforce doc (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex.htm):

The Salesforce datatype anyType is not supported in WSDLs used to generate Apex code that is saved using API version 15.0 and later. For code saved using API version 14.0 and earlier, anyType is mapped to String.

It appears to only be used on the NewValue and OldValue elements on History Types. E.g. from AccountHistory. These are the code lines that are creating errors:
 
<element name="NewValue" nillable="true" minOccurs="0" type="xsd:anyType"/>
<element name="OldValue" nillable="true" minOccurs="0" type="xsd:anyType"/>

Convert the anyType into a string and you're good to go!
 
<element name="NewValue" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="OldValue" nillable="true" minOccurs="0" type="xsd:string"/>

Note: XML is case sensitive format.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas