1

I have wsdl file i want to parse wsdl into APEX but when i try to do this i get following error::"Error: Failed to parse wsdl: Unknown element: import"

MY WSDL/XML file is

<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions name="ExternalServiceFacade" targetNamespace="http://www.materialise.be/eRP" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www.materialise.be/eRP" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:i0="http://tempuri.org/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
  <wsdl:import namespace="http://tempuri.org/" location="https://sv7767.si-servers.com/Streamics-test/External.svc?wsdl=wsdl0" /> 
- <wsdl:types>
- <xsd:schema targetNamespace="http://www.materialise.be/eRP/Imports">
  <xsd:import schemaLocation="https://sv7767.si-servers.com/Streamics-test/External.svc?xsd=xsd0" namespace="http://www.materialise.be/eRP" /> 
  <xsd:import schemaLocation="https://sv7767.si-servers.com/Streamics-test/External.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /> 
  <xsd:import schemaLocation="https://sv7767.si-servers.com/Streamics-test/External.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/eRP.ExternalService.Model" /> 
  <xsd:import schemaLocation="https://sv7767.si-servers.com/Streamics-test/External.svc?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/eRP.ExternalService.Model.Base" /> 
  <xsd:import schemaLocation="https://sv7767.si-servers.com/Streamics-test/External.svc?xsd=xsd4" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /> 
  <xsd:import schemaLocation="https://sv7767.si-servers.com/Streamics-test/External.svc?xsd=xsd5" namespace="http://schemas.datacontract.org/2004/07/Materialise.eRP.Entities" /> 
  </xsd:schema>
  </wsdl:types>
- <wsdl:message name="IExternalService_CreateCustomer_InputMessage">
  <wsdl:part name="parameters" element="tns:CreateCustomer" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_CreateCustomer_OutputMessage">
  <wsdl:part name="parameters" element="tns:CreateCustomerResponse" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_CreateCustomerWithContactPersons_InputMessage">
  <wsdl:part name="parameters" element="tns:CreateCustomerWithContactPersons" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_CreateCustomerWithContactPersons_OutputMessage">
  <wsdl:part name="parameters" element="tns:CreateCustomerWithContactPersonsResponse" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_UpdateCustomer_InputMessage">
  <wsdl:part name="parameters" element="tns:UpdateCustomer" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_UpdateCustomer_OutputMessage">
  <wsdl:part name="parameters" element="tns:UpdateCustomerResponse" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_GetCustomersCount_InputMessage">
  <wsdl:part name="parameters" element="tns:GetCustomersCount" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_GetCustomersCount_OutputMessage">
  <wsdl:part name="parameters" element="tns:GetCustomersCountResponse" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_GetAllCustomers_InputMessage">
  <wsdl:part name="parameters" element="tns:GetAllCustomers" /> 
  </wsdl:message>
- <wsdl:message name="IExternalService_GetAllCustomers_OutputMessage">
  <wsdl:part name="parameters" element="tns:GetAllCustomersResponse" /> 
  </wsdl:message>
- <wsdl:portType name="IExternalService">
- <wsdl:operation name="CreateCustomer">
  <wsdl:input wsaw:Action="http://www.materialise.be/eRP/ICustomerService/CreateCustomer" message="tns:IExternalService_CreateCustomer_InputMessage" /> 
  <wsdl:output wsaw:Action="http://www.materialise.be/eRP/ICustomerService/CreateCustomerResponse" message="tns:IExternalService_CreateCustomer_OutputMessage" /> 
  </wsdl:operation>
- <wsdl:operation name="CreateCustomerWithContactPersons">
  <wsdl:input wsaw:Action="http://www.materialise.be/eRP/ICustomerService/CreateCustomerWithContactPersons" message="tns:IExternalService_CreateCustomerWithContactPersons_InputMessage" /> 
  <wsdl:output wsaw:Action="http://www.materialise.be/eRP/ICustomerService/CreateCustomerWithContactPersonsResponse" message="tns:IExternalService_CreateCustomerWithContactPersons_OutputMessage" /> 
  </wsdl:operation>
- <wsdl:operation name="UpdateCustomer">
  <wsdl:input wsaw:Action="http://www.materialise.be/eRP/ICustomerService/UpdateCustomer" message="tns:IExternalService_UpdateCustomer_InputMessage" /> 
  <wsdl:output wsaw:Action="http://www.materialise.be/eRP/ICustomerService/UpdateCustomerResponse" message="tns:IExternalService_UpdateCustomer_OutputMessage" /> 
  </wsdl:operation>
- <wsdl:operation name="GetCustomersCount">
  <wsdl:input wsaw:Action="http://www.materialise.be/eRP/ICustomerService/GetCustomersCount" message="tns:IExternalService_GetCustomersCount_InputMessage" /> 
  <wsdl:output wsaw:Action="http://www.materialise.be/eRP/ICustomerService/GetCustomersCountResponse" message="tns:IExternalService_GetCustomersCount_OutputMessage" /> 
  </wsdl:operation>
- <wsdl:operation name="GetAllCustomers">
  <wsdl:input wsaw:Action="http://www.materialise.be/eRP/ICustomerService/GetAllCustomers" message="tns:IExternalService_GetAllCustomers_InputMessage" /> 
  <wsdl:output wsaw:Action="http://www.materialise.be/eRP/ICustomerService/GetAllCustomersResponse" message="tns:IExternalService_GetAllCustomers_OutputMessage" /> 
  </wsdl:operation>
- <wsdl:service name="ExternalServiceFacade">
- <wsdl:port name="BasicHttpBinding_IExternalService" binding="i0:BasicHttpBinding_IExternalService">
  <soap:address location="https://sv7767.si-servers.com/Streamics-test/External.svc" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
1
  • I think apex is not able to import the types. Can you try copy paste the types from all import tags in this XML and try again? Aug 8, 2014 at 5:48

2 Answers 2

2

The "Generate from WSDL" (aka wsdl2apex) tooling has a number of limitations in the WSDL and XSD Schema that it can handle. See the "Supported WSDL Features" section of SOAP Services: Defining a Class from a WSDL Document. Sometimes it is possible to edit the WSDL to work around those limitations.

In this case you need to get the XML Schema files from the schemaLocation listed early in the WSDL and replace the xsd:imports with the XML Schema file content itself. You can use tools such as online WSDL validators to check your editing. Then try "Generate from WSDL" again and address any further problems.

2

I've been working on a tool that extends the Apex support for WSDLs without the need to manually manipulate the WSDL before hand. One of the features is explict support for wsdl:import elements.

You can get it for Windows via http://www.fuseit.com/Solutions/SFDC-Explorer/Help-WSDL-Parser.aspx. (Disclaimer: I work for the company that makes this tool. It is free to download and use.)

It will need to executed on a machine where https://sv7767.si-servers.com can be resolved.

Note also, your WSDL as listed in the question is missing the closing </wsdl:portType> tag. The tool won't be able to compensate for invalid XML.

You must log in to answer this question.

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