3

I am having a wsdl document developed in .net framework. I am trying to create New Apex Code from that WSDL document but I am keep getting errors. I have resolved couple of them and now am getting a weird one.

Error: Failed to parse wsdl: schema:targetNamespace can not be null

How can I resolved all my wsdl document errors.

Here is my WSDL goo.gl/awMRto

2
  • Can you share the source WSDL? Jul 10, 2017 at 2:19
  • Here it is goo.gl/awMRto
    – maxspan
    Jul 10, 2017 at 2:26

1 Answer 1

2

That WSDL only has a SOAP 1.2 address defined in the wsdl:service.

WSDL2Apex requires a SOAP 1.1 port type to function. If the WSDL had both Soap 1.1 and 1.2 it would be possible to get it to work, but that doesn't appear to be the case here.

You will need to manually create the SOAP requests from Apex and parse the responses.

Also, vote for the Idea: Support for SOAP 1.2. I'd be extremely surprised if it ever happened, but you never know.


For what it's worth, that specific error is coming from the xs:schema that is missing the targetNamespace attribute. That attribute is used to drive the name of the Apex class that will contain the elements defined in the namespace.

However, as noted above, even if you alter this you won't get much further due to the SOAP 1.2 incompatibility.

    <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="DataSet" nillable="true">
            <xs:complexType>
                <xs:annotation>
                    <xs:appinfo>
                        <ActualType Name="DataSet" Namespace="http://schemas.datacontract.org/2004/07/System.Data" xmlns="http://schemas.microsoft.com/2003/10/Serialization/"/>
                    </xs:appinfo>
                </xs:annotation>
                <xs:sequence>
                    <xs:element ref="xs:schema"/>
                    <xs:any/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>    
8
  • Is there any way to avoid the manual call to SOAP.
    – maxspan
    Jul 10, 2017 at 3:46
  • @maxspan Do you have control of the web service? If so, you could add soap 1.1 support there. Jul 10, 2017 at 3:48
  • Yes I have control over web service
    – maxspan
    Jul 10, 2017 at 4:00
  • Here is the SOAP 1.1 tinyurl.com/ydy2j44k
    – maxspan
    Jul 10, 2017 at 4:17
  • @maxspan There are further challenges for working from Apex. For instance, the GetNewStatusUpdatesResult element doesn't define a type. And it contains its own schema and xs:any. The latter not being supported by Wsdl2Apex either. Avoid returning DataSets if you want to use the methods in Apex. Return something strongly typed. Jul 10, 2017 at 4:23

You must log in to answer this question.

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