I have a problem with salesforce functionality. I've created flat WSDL file but when I am trying to create class in salesforce I still get this error:

Error: Failed to parse wsdl: Unsupported Schema element found http://www.w3.org/2001/XMLSchema:attribute. At: 462:40

The WSDL is (this is schema that contains error, line 462 is one with "xs:attribute name="contentType") :

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" targetNamespace="http://www.w3.org/2005/05/xmlmime">
      <xs:attribute name="contentType">
          <xs:restriction base="xs:string">
            <xs:minLength value="3" />
      <xs:attribute name="expectedContentTypes" type="xs:string" />
      <xs:complexType name="base64Binary">
          <xs:extension base="xs:base64Binary">
            <xs:attribute ref="xmime:contentType" />
      <xs:complexType name="hexBinary">
          <xs:extension base="xs:hexBinary">
            <xs:attribute ref="xmime:contentType" />

any ideas?


1 Answer 1


The Salesforce wsdl2apex tool does not support a number of WSDL features. See Supported WSDL Features

That section does say:

Apex also supports the following schema constructs:

  • xsd:attribute, in Apex code saved using API version 15.0 and later

However, I've found in practice you usually get the Unsupported Schema element found error message that you encountered.

I've been working with an intern on an alternative WSDL to Apex converter to try and overcome a number of the limitations. You can get it for free from WSDL Parser and Apex Generator. Ensure you get v1.6.0 or later for WSDLs with attributes. It currently only supports Windows. (Full disclosure: I currently work for the company that creates this tool).

In this case the unsupported <xsd:attribute> elements will be skipped from the WSDL and warnings added to the resulting apex. You will need to manually enforce the 3 character limit on the hexBinary values.

Note that the Salesforce wsdl2apex tool doesn't support <xs:extension> either. We should be able to handle this by replicating the Apex members from the base class and extending the parameters passed to WebService.invoke.

If you do have further issues, can you share your WSDL via some other means (DropBox, Google Docs, etc...). It will be easier to check it as a whole.

  • 1
    Hi @daniel. Seems the link in your answer expired. Nevertheless, I think it's still relevant to many people. Any chance you can update it? Nov 30, 2023 at 10:26

You must log in to answer this question.

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