[SalesForce] How to work around lack of salesforce wsdl import tag support

Question

What techniques can I use to modify a 3rd party WSDL that includes import tags so that I can use the Salesforce generate apex class from WSDL feature?

Background

I'm a beginner at using WSDLs and I'm trying to implement a 3rd party WSDL on salesforce. When I try to parse the wsdl I get the error "Error: Failed to parse wsdl: Unsupported Schema element found http://www.w3.org/2001/XMLSchema:include. At: 13:54".

I'm making an assumption that this is referring to XMLSchema import tag

<xs:import
    namespace="http://ws.clareity.com/clareityStoreFaults"
    schemaLocation="clareityStoreFaults.xsd"></xs:import>

Is it possible to flatten the import statement so that the Salesforce WSDL to Apex parse can handle this? I've done a lot of googling but am having some trouble as I don't know the terminology to describe what I'm looking to do.

I've upload the WSDL and related files in it's entirety into a gist.

Best Answer

UPDATE: As it stands this doesn't actually work. You will get the message

Apex Generation Failed
No type specified for element vendorId

Most likely the issue is the missing first import that defines the data types.


I was able to get the WSDL to import and generate code by merging the content of clareityStoreFaults.xsd directly into the ClareityStore.wsdl. Note that I didn't do the same for the http://schemas.xmlsoap.org/wsdl/ import.

So the steps were:

  1. Comment out <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"></xs:import>
  2. Comment out <xs:import namespace="http://ws.clareity.com/clareityStoreFaults" schemaLocation="clareityStoreFaults.xsd"></xs:import>
  3. Paste the contents of clareityStoreFaults.xsd xs:schema element under the commented out code from step 2.
  4. Import the modified WSDL into Salesforce

I haven't been able to test if it actually works against the web service, but it does import and generate code.

Related Topic