2

I'm stuck with generating apex classes from this WSDL. Is there a way to solve the missing namespace error? Is there an alternative way to generate apex classes from WSDL? Thank you.

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="COINSInterface">
<xs:complexType>
<xs:sequence>
<xs:element name="Header">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="UserID" type="xs:string" />
        <xs:element minOccurs="0" name="From" type="xs:string" />
        <xs:element minOccurs="0" name="HostName" type="xs:string" />
        <xs:element minOccurs="0" name="Environment" type="xs:string" />
        <xs:element minOccurs="0" name="Created" type="xs:dateTime" />
        <xs:element minOccurs="0" name="Version" type="xs:string" />
        <xs:element minOccurs="0" name="Login">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" name="AuthToken" type="xs:string" />
              <xs:element minOccurs="0" name="User" type="xs:string" />
              <xs:element minOccurs="0" name="Password" type="xs:string" />
              <xs:element minOccurs="0" name="CID" type="xs:unsignedInt" />
              <xs:element minOccurs="0" name="Group" type="xs:string" />
              <xs:element minOccurs="0" name="extUser" type="xs:string" />
              <xs:element minOccurs="0" name="extAuth" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" use="optional" />
      <xs:attribute name="confirm" use="optional">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="yes" />
            <xs:enumeration value="y" />
            <xs:enumeration value="true" />
            <xs:enumeration value="no" />
            <xs:enumeration value="n" />
            <xs:enumeration value="false" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="action" use="optional">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="CREATE" />
            <xs:enumeration value="DELETE" />
            <xs:enumeration value="UPDATE" />
            <xs:enumeration value="PUBLISH" />
            <xs:enumeration value="ACKNOWLEDGE" />
            <xs:enumeration value="EXCEPTION" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="entity" type="xs:string" use="optional" />
      <xs:attribute name="arguments" type="xs:string" use="optional" />
      <xs:attribute name="ackID" type="xs:string" use="optional"/>
      <xs:attribute name="testMsg" type="xs:boolean" use="optional"/>
    </xs:complexType>
</xs:element>
<xs:element name="Body">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" name="vp_siteRow">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="externalID" type="xs:string" />
              <xs:element name="job_num" type="xs:string" />
              <xs:element name="jph_phase" type="xs:string" />
              <xs:element name="hfc_code" type="xs:string" />
              <xs:element name="updateForecast" type="xs:boolean" />
              <xs:element name="updateActual" type="xs:boolean" />

           <xs:element minOccurs="0" maxOccurs="unbounded" name="vp_wbsdefRow">
                <xs:complexType>
                  <xs:sequence>
                     <xs:element name="externalID" type="xs:string" />
                     <xs:element name="vwb_code" type="xs:string" />

           <xs:element minOccurs="0" maxOccurs="unbounded" name="hs_stageRow">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="externalID" type="xs:string" />
                          <xs:element name="hss_stage" type="xs:string" />
                 <xs:element minOccurs="0" name="hfc_forecast" type="xs:date" />
                 <xs:element minOccurs="0" name="hfc_actual" type="xs:date" />
         <xs:element minOccurs="0" name="hfc_start" type="xs:date" />
         <xs:element minOccurs="0" name="hfc_progress" type="xs:unsignedInt" />
                         </xs:sequence>
                      </xs:complexType>
           </xs:element>

                  </xs:sequence>
                </xs:complexType>
           </xs:element>

            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="COINSInterfaceResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Header">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="UserID" type="xs:string" />
        <xs:element minOccurs="0" name="From" type="xs:string" />
        <xs:element minOccurs="0" name="HostName" type="xs:string" />
        <xs:element minOccurs="0" name="Environment" type="xs:string" />
        <xs:element minOccurs="0" name="Created" type="xs:dateTime" />
        <xs:element minOccurs="0" name="Version" type="xs:string" />
        <xs:element minOccurs="0" name="SchemaVersion" type="xs:string" />
        <xs:element minOccurs="0" name="Object" type="xs:string" />
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" use="optional" />
      <xs:attribute name="confirm" use="optional">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="yes" />
            <xs:enumeration value="y" />
            <xs:enumeration value="true" />
            <xs:enumeration value="no" />
            <xs:enumeration value="n" />
            <xs:enumeration value="false" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="action" use="optional">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="CREATE" />
            <xs:enumeration value="DELETE" />
            <xs:enumeration value="UPDATE" />
            <xs:enumeration value="PUBLISH" />
            <xs:enumeration value="ACKNOWLEDGE" />
            <xs:enumeration value="RESPONSE" />
            <xs:enumeration value="EXCEPTION" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="entity" type="xs:string" use="optional" />
      <xs:attribute name="ackID" type="xs:string" use="optional"/>
      <xs:attribute name="initialise" type="xs:boolean" use="optional"/>
      <xs:attribute name="initCount" type="xs:int" use="optional"/>
      <xs:attribute name="sin_ref" type="xs:int" use="optional"/>
    </xs:complexType>
</xs:element>
<xs:element name="Body">
<xs:complexType>
 <xs:sequence>
  <xs:element minOccurs="0" name="Exception">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Exception" type="xs:string" />
        <xs:element name="ThrownAt" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
 </xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="doAction">
<wsdl:part name="parameters" element="COINSInterface"/>
</wsdl:message>
<wsdl:message name="doActionResponse">
<wsdl:part name="parameters" element="COINSInterfaceResponse"/>
</wsdl:message>
<wsdl:portType name="COINSInterfacePort">
<wsdl:operation name="doAction">
<wsdl:input message="doAction"/>
<wsdl:output message="doActionResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="COINSInterfaceBinding" type="COINSInterfacePort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="doAction">
<soap:operation soapAction="https://henleyis.coinscloud.com/env/oademo/wouesb.p?service=HSESB034&amp;namespace=true" 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="Service">
<wsdl:port name="COINSInterface" binding="COINSInterfaceBinding">
<soap:address location="https://henleyis.coinscloud.com/env/oademo/wouesb.p?service=HSESB034&amp;namespace=true"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
3
  • 1
    Is there a WSDL definition with namespace included you can ask from your source? Also check out supported definitions.This error is not by the SOAP version, so you can rule that out.
    – Atlas Can
    Apr 19 '20 at 10:36
  • 1
    In your WSDL file, 'targetNamespace 'is missing. TargetNamespace is attribute of <wsdl:definitions> and <xs:schema> The target namespace would be the one where request will go to from Salesforce. If you know the target namespace add this directly Apr 19 '20 at 10:51
  • @AtlasCan I was able to get a definition with the namespace provided, thank you Apr 22 '20 at 4:42
3

I just tried to process the WSDL you provided. The error was:

Missing namespace for operation: [doAction] PortType:COINSInterfacePort Parameter name: Input.Message.Namespace

This corresponds to this portion of the WSDL:

<wsdl:portType name="COINSInterfacePort">
    <wsdl:operation name="doAction">
        <wsdl:input message="doAction"/>
        <wsdl:output message="doActionResponse"/>
    </wsdl:operation>
</wsdl:portType>

In particular, this element:

<wsdl:input message="doAction"/>

Notice that it is just a name with no namespace defined? If it had the namespace defined it would appear more like:

<wsdl:input message="somenamespace:doAction"/> 

For that to work you would need to add a targetNamespace attribute to the wsdl:definitions element and the xs:schema as well.

The other challenge with this WSDL is the nested complex types that are defined in the schema. You will likely need to split (unnest) these out into distinct elements.

E.g. COINSInterface would be come something like:

        <xs:element name="COINSInterface">
            <xs:complexType>
                <xs:sequence>
                    <xs:element name="Header" type="tns:Header" nillable="true" />
                    <xs:element name="Body" type="tns:Body" nillable="true" />
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        <xs:element name="Header">
          <!-- Elements nested under header are now hear. -->
        </xs:element>
        <xs:element name="Body">
          <!-- Elements nested under body are now hear. -->
        </xs:element>        

But you are going to need to drill all the way down through all the various types.

1
  • 1
    thank you for the help and the SFDC explorer :) Apr 22 '20 at 4:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.