I'm trying to import metadata wsdl in my dev org, i'm getting following error any help?

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

Also I'm looking to create Remote Access setting from Apex, so if there is any other option to do it other than metadata api, let me know as well.


  • by Remote Access setting do you mean Remote Site setting or Connected Apps? Dec 16, 2014 at 19:20
  • Have a look at the Apex Wrapper Salesforce Metadata API by Andrew Fawcett. It addresses a number of the issues encountered when trying to work with the Metadata API directly from Apex. Dec 17, 2014 at 0:31
  • Yes I have used that wrapper, its more about understanding the issues not just solving this one problem, It seems like SFDC don't like attribute name in xml to be duplicated, once I fix it, the import process works but the class file is too big i guess, its not showing up in my org. The issues are described in this talk, slideshare.net/danielballinger/… Thanks to both of you. I try tool in above talk or split up the wsdl to reimport only whats useful.
    – realnumber
    Dec 17, 2014 at 0:56
  • yes, having to split up (or clean up) wsdl's is quite common when using wsdl2apex. Dec 17, 2014 at 8:03
  • @realnumber That is my talk from Dreamforce this year. With the metadata API try using the FuseIT SFDC Explorer to generate the HTTP Requests for you. This should convert them into a List<DOM.XmlNode>. Dec 17, 2014 at 21:36

3 Answers 3


anyType is not supported by wsdl2apex.

See this page for a list of supported xml schema types: https://developer.salesforce.com/page/Apex_Web_Services_and_Callouts (almost at the bottom)

Is it an option to replace the anyType by a supported type? Or e.g. a String?


Convert the anyType into string and you're good to go!


I will tell you real answer.

Remove all reference of anytype from partner.xml.

and replace below line

element name="value" type="xsd:anytype" minOccurs="1" maxOccurs="unbounded"
element name="value" type="xsd:string" minOccurs="1" maxOccurs="unbounded"


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .