Skip to main content

Problems Consuming WSDLs

Problems Consuming WSDLs

If you have a problem using the SOAP Wizard (or the %SOAP.WSDL.ReaderOpens in a new tab class, which the wizard uses), the problem is likely to be one of the following:

  • The WSDL is protected by SSL. In this case, the wizard issues the following error:

    ERROR #6301: SAX XML Parser Error: invalid document structure 
    while processing Anonymous Stream at line 1 offset 1
    

    You can specify an SSL configuration when using the wizard, but if you have done so, and you receive the preceding error, your SSL configuration is incorrect. You can try accessing the WSDL in another way, downloading it to a file, and using the file WSDL instead.

  • The WSDL is password protected. In this case, the wizard issues an error like the following (notice that the line and offset vary but are different from the previous scenario):

    ERROR #6301: SAX XML Parser Error: Expected entity name for reference 
    while processing Anonymous Stream at line 10 offset 27 
    

    If you receive this error, check whether a password is required; see the comments in “Using the SOAP Wizard,” earlier in this book.

  • The WSDL uses elements that are currently inaccessible. In this case, the wizard issues an error like the following:

    ERROR #6416: Element 'wsdl:definitions' - unrecognized wsdl element 'porttype'
    

    The key word is unrecognized; this indicates that the WSDL refers to an element that is currently inaccessible. Carefully check the WSDL for <import> and <include> directives.

    An import directive might look like this:

    <import namespace="http://example.com/stockquote/definitions"
               location="http://example.com/stockquote/stockquote.wsdl"/>
    

    In this case, the workaround is as follows:

    • Download the primary WSDL to a file.

    • Download the referenced WSDL to a file.

    • Edit the primary WSDL to refer to the new location of the referenced WSDL.

    Similarly, it is possible for a WSDL to refer to other documents via a relative URL. For example:

    xmlns:acme="urn:acme.com.:acme:service:ServiceEndpointInterface" 
    

    If you have downloaded the WSDL to a file, this relative reference cannot work. In this case, you must also download the referenced document and edit the WSDL to use its new location.

  • The WSDL contains <message> elements with multiple parts and uses document-style binding. In this case, the wizard issues the following error:

    ERROR #6425: Element 'wsdl:binding:operation:msg:input' - message 'AddSoapOut' 
    Message Style must be used for document style message with 2 or more parts.
    
    

    In this case, select the Use unwrapped message format for document style web methods option when you use the wizard.

  • The WSDL is invalid. In such cases, the SOAP wizard issues an error to indicate the problem. The following shows one example:

    ERROR #6419: Element 'wsdl:binding:operation' - inconsistent
    soap:namespace for operation getWidgetInfo
    

    This error message indicates a problem with an <operation> element. The following shows a partial example of the invalid WSDL that produced this error:

    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="http://acme.acmecorp.biz:9999/widget/services" 
                      xmlns="http://schemas.xmlsoap.org/wsdl/" 
                      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" =
                     [parts omitted]>
      <wsdl:message name="getWidgetInfoRequest">
      </wsdl:message>
      <wsdl:message name="getWidgetInfoResponse">
        <wsdl:part name="getWidgetInfoReturn" type="xsd:string"/>
      </wsdl:message>
      <wsdl:portType name="Version">
        <wsdl:operation name="getWidgetInfo">
          <wsdl:input message="impl:getWidgetInfoRequest" name="getWidgetInfoRequest"/>
          <wsdl:output message="impl:getWidgetInfoResponse" name="getWidgetInfoResponse"/>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="VersionSoapBinding" type="impl:Version">
        <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getWidgetInfo">
          <wsdlsoap:operation soapAction=""/>
          <wsdl:input name="getWidgetInfoRequest">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
                           namespace="http://acmesubsidiary.com" 
                           use="encoded"/>
          </wsdl:input>
          <wsdl:output name="getWidgetInfoResponse">
            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"                                       
                           namespace="http://acme.acmecorp.biz:9999/widget/services" 
                           use="encoded"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      [parts omitted]
    

    In this case, the problem is that the <input> part of <operation> states that the request message (getVersionRequest) is in the namespace "http://acmesubsidiary.com", but the earlier part of the WSDL shows that this message is the target namespace of the web service: "http://acme.acmecorp.biz:9999/widget/services".

    Note that an invalid WSDL document can be a valid XML document, so using a pure XML tool to validate the WSDL is not a sufficient test. Some third-party WSDL validation tools are available, and you can also examine the WSDL directly, using information returned by the SOAP wizard.

  • The WSDL contains features that are not supported in Caché. See the section “Consuming WSDLs” in the first chapter.

FeedbackOpens in a new tab