5

I am trying to import a WSDL in order to create the apex wrapper for a Dynamics Axapta SOAP Service.

Firstly, I've commented 'xsd:import' elements because Salesforce not support them. After this, I choose the wsdl document, I click the Parse WSDL button and parse it successfully. But when I want to generate Apex code I get this error enter image description here

Unable to find element for {http://schemas.microsoft.com/dynamics/2008/01/services}ACTSFToAxServiceInsertContactResponse

However, If you put this url http ://schemas.microsoft.com/dynamics/2008/01/services in the browser, you will see the next message

'The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.'.

I've tried to create a Soap Project with the SoapUI application and it was created successfully.

I've also googled unsuccessfully about why this url http ://schemas.microsoft.com/dynamics/2008/01/services is unavailable.

Could it be the WSDL document malformed? Should I replace that schema url by the service ?

This is a WSDL snippet:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions name="ACTSFToAxService" targetNamespace="http://schemas.microsoft.com/dynamics/2008/01/services" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://schemas.microsoft.com/dynamics/2008/01/services" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsp:Policy wsu:Id="BasicHttpBinding_ACTSFToAxService_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <http:NegotiateAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http"/>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>
        <xsd:schema targetNamespace="http://schemas.microsoft.com/dynamics/2008/01/services/Imports">
            <!-- <xsd:import namespace="http://schemas.microsoft.com/dynamics/2008/01/services" schemaLocation="http://XXXXX/MicrosoftDynamicsAXAif50/actsftoaxservice.svc?xsd=xsd0"/>
            <xsd:import namespace="http://schemas.microsoft.com/dynamics/2008/01/documents/Fault" schemaLocation="http://XXXXX/MicrosoftDynamicsAXAif50/actsftoaxservice.svc?xsd=xsd3"/>
            <xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" schemaLocation="http://XXXXX/MicrosoftDynamicsAXAif50/actsftoaxservice.svc?xsd=xsd1"/>
            <xsd:import namespace="http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.IntegrationFramework.Service" schemaLocation="http://XXXXX/MicrosoftDynamicsAXAif50/actsftoaxservice.svc?xsd=xsd2"/> -->
        </xsd:schema>
        <xsd:schema targetNamespace="http://schemas.microsoft.com/dynamics/2008/01/services"></xsd:schema>
        <xsd:schema targetNamespace="http://schemas.microsoft.com/dynamics/2008/01/documents/Fault"></xsd:schema>
        <xsd:schema targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"></xsd:schema>
        <xsd:schema targetNamespace="http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.IntegrationFramework.Service"></xsd:schema>
    </wsdl:types>
    <wsdl:message name="ACTSFToAxServiceInsertContactRequest">
        <wsdl:part element="tns:ACTSFToAxServiceInsertContactRequest" name="parameters"/>
    </wsdl:message>
    <wsdl:message name="ACTSFToAxServiceInsertContactResponse">
        <wsdl:part element="tns:ACTSFToAxServiceInsertContactResponse" name="parameters"/>
    </wsdl:message>
    <wsdl:message name="ACTSFToAxService_insertContact_AifFaultFault_FaultMessage">
        <wsdl:part element="q1:AifFault" name="detail" xmlns:q1="http://schemas.microsoft.com/dynamics/2008/01/documents/Fault"/>
    </wsdl:message>
1
  • 2
    If the schemas for which you have commented out the imports are referenced in your WSDL then you will need to manually add them inline in your WSDL (which takes a bit of knowledge of the details of WSDL). You may then hit some of the other limitations - carefully review SOAP Services: Defining a Class from a WSDL Document. If that product has an equivalent REST/JSON API, you may find that easier to use from Apex.
    – Keith C
    Feb 29, 2016 at 17:05

1 Answer 1

3

Can you share the WSDL in question? I've made a free alternative version of WSDL2Apex that can process xsd imports directly - See FuseIT SFDC Explorer.

Generally speaking with imports (as Keith commented), if you are doing it manually you need to flatten the contents of the commented out import into the main WSDL.

Also, the schema you want won't be at http://schemas.microsoft.com/dynamics/2008/01/services. That is the namespace for the import. Confusingly this namespace takes the form of the URL. Instead the imports contents will be at http://XXXXX/MicrosoftDynamicsAXAif50/actsftoaxservice.svc?xsd=xsd0

5
  • Hi Daniel, Thanks for your quick response. I have donwloaded FuseIT application and I was able to generate the apex classes from the original wsdl (including xsd:imports), it works fine. Now I'm facing a new issue. Since the imported schema contains variable's name that start with underscore, salesforce is not accepting the generated Apex classes. i.e. public String _VATNum; public String _accountNum; But your application is working ok. Thank you. Mar 2, 2016 at 8:19
  • @AlbertoSanchez Ah, I've just updated the code so it won't try and create variable names that start with an underscore. The next release (due out today) will fix this. Thanks for the feedback. Mar 2, 2016 at 19:35
  • @DanielBallingerI think is a good improve to avoid the underscore errors in variable's name, but I still have the problem with currency variable. 'currency' is a reserved word for Salesforce. Salesforce message: Identifier name is reserved: currency Thank you anyway! Mar 3, 2016 at 12:13
  • @AlbertoSanchez In theory the existing code should identify currency as a reserved keyword and suffix it with _x. Can you show me a snippet of the problem generated code? Mar 3, 2016 at 18:43
  • It's true, I've generated apex classes again and I've seen that 'currency' variable was renamed to 'currency_x'. Now the classes are 100% compatible with Salesforce. Good Job!. Mar 4, 2016 at 7:07

You must log in to answer this question.

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