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
U D NU D N 

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

Error .. from  Partner WSDL  to Generated New Apex Code from WSDL
 
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
U D NU D N
Hi Anas  ,
These are the code lines are not in Partner WSDL file which i Generated