You need to sign in to do that
Don't have an account?

Referencing external schemas in a WSDL
Hello,
I am getting the following error when trying to parse a WSDL and generate the relevant Apex classes in SalesForce:
"Error: Failed to parse wsdl: Found schema import from location https://*.xsd. External schema import not supported."
I believe that the following (edited) section of the WSDL referring to an external schema is what's causing the problem:
...
<wsdl:types>
<xs:schema>
<xs:import namespace="" schemaLocation="https://*.xsd"/>
</xs:schema>
<xs:schema>
<xs:import namespace="" schemaLocation="https://*.xsd"/>
</xs:schema>
</wsdl:types>
...
Can anyone confirm that this is in fact not allowed by Salesforce and if there is any remedy other than embedding the schema in the WSDL?
Thanks,
agab-
Hi,
I had to deal with an WSDL with external schemas which they also import other schemas. It was a mess at first but the solution was easier than I thought.
1. Open the WSDL with a text editor
2. Inside <wsdl:types> (below the last <schema>) paste each referenced .xsd file content. Paste only <schema></schema>
3. Once all schemas are in the WSDL then comment all <xsd:import> using <!-- -->. They are no longer needed.
4. Save and you are ready to go.
Some of my classes returned compiling errors because of Exception classes that must extend the Salesforce Exception class. So copy the generated class, correct it into a text editor and then created manually as after clicking "Done", changes are not reprocessed.
Regards,
Sebastian
All Answers
I'm a newb, can you or someone explain or show me to me how to
"re-work the wsdl to have all the imported schemas in the wsdl document directly." ??
Hi,
I had to deal with an WSDL with external schemas which they also import other schemas. It was a mess at first but the solution was easier than I thought.
1. Open the WSDL with a text editor
2. Inside <wsdl:types> (below the last <schema>) paste each referenced .xsd file content. Paste only <schema></schema>
3. Once all schemas are in the WSDL then comment all <xsd:import> using <!-- -->. They are no longer needed.
4. Save and you are ready to go.
Some of my classes returned compiling errors because of Exception classes that must extend the Salesforce Exception class. So copy the generated class, correct it into a text editor and then created manually as after clicking "Done", changes are not reprocessed.
Regards,
Sebastian
Hello,
I'm having this same problem and I was trying to follow your instructions to solve this, but I gotta confess I'm not being successful AT ALL!
So can I ask for you to please add some code sample to your post? It would be incredibely helpful and greatly appreciated.
Thank you in advance.
EF
Hi, try to paste here a short version of your wsdl and one of the referenced .xsd files.
I'll see if I can help
Regards
Hi, thanks for the fast reply.
I think (!!) I almost got it, but nevertheless, won't hurt to use some expert help.
Here is part of my wsdl:
And here is the .xsd: https://e2e.gs1pt.org/Gs1SyncPTe2e/CNDEntityService.svc?xsd=xsd0
Do I have to replace the <xsd:import> for the whole xs:schema? That's it?
Thanks again.
EF
No, try by commenting the xsd:import and paste the whole xsd file content below the last <xsd:schema>
If it does not make it, try replacing the xsd:import with the referenced file content.
See below my idea
Let me know how it goes
Regards
Ok, so I did this:
And I got another error:
EF
Hi Sebastian,
It worked! I'm having other problems, but you know... I'll figure it out.
Thank you very so much for you time and help. It was greatly appreciated.
Best regards,
EF
I am having same issue with parsing WSDL2APEX,
here is my wsdl, can you please look into this once and can you guide me for the solution
Error: Failed to parse wsdl: Found schema import from location http://122.181.153.203/SFDC/CL_MainService.svc?xsd=xsd0. External schema import not supported
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="CL_MainService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://122.121.193.283/SFDC/CL_MainService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://122.121.193.283/SFDC/CL_MainService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="CL_MainService_set_Username_InputMessage">
<wsdl:part name="parameters" element="tns:set_Username"/>
</wsdl:message>
<wsdl:message name="CL_MainService_set_Username_OutputMessage">
<wsdl:part name="parameters" element="tns:set_UsernameResponse"/>
</wsdl:message>
<wsdl:message name="CL_MainService_set_Password_InputMessage">
<wsdl:part name="parameters" element="tns:set_Password"/>
</wsdl:message>
<wsdl:message name="CL_MainService_set_Password_OutputMessage">
<wsdl:part name="parameters" element="tns:set_PasswordResponse"/>
</wsdl:message>
<wsdl:message name="CL_MainService_set_CustomerCode_InputMessage">
<wsdl:part name="parameters" element="tns:set_CustomerCode"/>
</wsdl:message>
<wsdl:message name="CL_MainService_set_CustomerCode_OutputMessage">
<wsdl:part name="parameters" element="tns:set_CustomerCodeResponse"/>
</wsdl:message>
<wsdl:message name="CL_MainService_set_PropertyCode_InputMessage">
<wsdl:part name="parameters" element="tns:set_PropertyCode"/>
</wsdl:message>
<wsdl:message name="CL_MainService_set_PropertyCode_OutputMessage">
<wsdl:part name="parameters" element="tns:set_PropertyCodeResponse"/>
</wsdl:message>
<wsdl:message name="CL_MainService_WS_GetSalesOffice_InputMessage">
<wsdl:part name="parameters" element="tns:WS_GetSalesOffice"/>
</wsdl:message>
<wsdl:message name="CL_MainService_WS_GetSalesOffice_OutputMessage">
<wsdl:part name="parameters" element="tns:WS_GetSalesOfficeResponse"/>
</wsdl:message>
<wsdl:message name="CL_MainService_WS_GetSalesExecutives_InputMessage">
<wsdl:part name="parameters" element="tns:WS_GetSalesExecutives"/>
</wsdl:message>
<wsdl:message name="CL_MainService_WS_GetSalesExecutives_OutputMessage">
<wsdl:part name="parameters" element="tns:WS_GetSalesExecutivesResponse"/>
</wsdl:message>
<wsdl:message name="CL_MainService_WS_CollectionExecutives_InputMessage">
<wsdl:part name="parameters" element="tns:WS_CollectionExecutives"/>
</wsdl:message>
<wsdl:message name="CL_MainService_WS_CollectionExecutives_OutputMessage">
<wsdl:part name="parameters" element="tns:WS_CollectionExecutivesResponse"/>
</wsdl:message>
<wsdl:portType name="CL_MainService">
<wsdl:operation name="set_Username">
<wsdl:input wsaw:Action="http://tempuri.org/CL_MainService/set_Username" message="tns:CL_MainService_set_Username_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/CL_MainService/set_UsernameResponse" message="tns:CL_MainService_set_Username_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="set_Password">
<wsdl:input wsaw:Action="http://tempuri.org/CL_MainService/set_Password" message="tns:CL_MainService_set_Password_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/CL_MainService/set_PasswordResponse" message="tns:CL_MainService_set_Password_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="set_CustomerCode">
<wsdl:input wsaw:Action="http://tempuri.org/CL_MainService/set_CustomerCode" message="tns:CL_MainService_set_CustomerCode_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/CL_MainService/set_CustomerCodeResponse" message="tns:CL_MainService_set_CustomerCode_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="set_PropertyCode">
<wsdl:input wsaw:Action="http://tempuri.org/CL_MainService/set_PropertyCode" message="tns:CL_MainService_set_PropertyCode_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/CL_MainService/set_PropertyCodeResponse" message="tns:CL_MainService_set_PropertyCode_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="WS_GetSalesOffice">
<wsdl:input wsaw:Action="http://tempuri.org/CL_MainService/WS_GetSalesOffice" message="tns:CL_MainService_WS_GetSalesOffice_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/CL_MainService/WS_GetSalesOfficeResponse" message="tns:CL_MainService_WS_GetSalesOffice_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="WS_GetSalesExecutives">
<wsdl:input wsaw:Action="http://tempuri.org/CL_MainService/WS_GetSalesExecutives" message="tns:CL_MainService_WS_GetSalesExecutives_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/CL_MainService/WS_GetSalesExecutivesResponse" message="tns:CL_MainService_WS_GetSalesExecutives_OutputMessage"/>
</wsdl:operation>
<wsdl:operation name="WS_CollectionExecutives">
<wsdl:input wsaw:Action="http://tempuri.org/CL_MainService/WS_CollectionExecutives" message="tns:CL_MainService_WS_CollectionExecutives_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/CL_MainService/WS_CollectionExecutivesResponse" message="tns:CL_MainService_WS_CollectionExecutives_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_CL_MainService" type="tns:CL_MainService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="set_Username">
<soap:operation soapAction="http://tempuri.org/CL_MainService/set_Username" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="set_Password">
<soap:operation soapAction="http://tempuri.org/CL_MainService/set_Password" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="set_CustomerCode">
<soap:operation soapAction="http://tempuri.org/CL_MainService/set_CustomerCode" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="set_PropertyCode">
<soap:operation soapAction="http://tempuri.org/CL_MainService/set_PropertyCode" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="WS_GetSalesOffice">
<soap:operation soapAction="http://tempuri.org/CL_MainService/WS_GetSalesOffice" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="WS_GetSalesExecutives">
<soap:operation soapAction="http://tempuri.org/CL_MainService/WS_GetSalesExecutives" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="WS_CollectionExecutives">
<soap:operation soapAction="http://tempuri.org/CL_MainService/WS_CollectionExecutives" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CL_MainService">
<wsdl:port name="BasicHttpBinding_CL_MainService" binding="tns:BasicHttpBinding_CL_MainService">
<soap:address location="http://122.121.193.283/SFDC/CL_MainService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Error: Failed to parse wsdl: Parse error: Found invalid XML. start tag not allowed in epilog but got d (position: END_TAG seen ...ProductPriceInquiry/2013-02-11/productpriceinquiry_V2"/>-->\r\n\t\t\t