Search code examples
web-servicessoapwsdlsoasap-basis

incorrect value: unknown namespace http://www.w3.org/2001/xmlschema


I am trying to consume external Web service(WSDL FILE) in sap for data integration when I tried to create client proxy in SAP and gives service provider webservice URL http://172.31.3.48:8717/?wsdl it gives me proxy generation error:

Exception occurred in library handler

incorrect value: unknown namespace http://www.w3.org/2001/xmlschema

I am facing this error in just in this file which provided by my services provider , except this all of the WSDL file generated successfully one the file which generated successfully is this http://www.webservicex.net/stockquote.asmx?WSDL.

Your help will be appreciated.

Given below is my WSDL file which giving me error:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema"
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
                  xmlns:tns="http://tempuri.org/"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
                  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  targetNamespace="http://tempuri.org/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:element name="GetData">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="user" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="pass" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="fromdate" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="todate" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetDataResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetDataResult">
              <s:complexType>
                <s:sequence>
                  <s:element ref="s:schema" />
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="GetDataSoapIn">
    <wsdl:part name="parameters" element="tns:GetData" />
  </wsdl:message>
  <wsdl:message name="GetDataSoapOut">
    <wsdl:part name="parameters" element="tns:GetDataResponse" />
  </wsdl:message>
  <wsdl:portType name="WSCRPL9001Soap">
    <wsdl:operation name="GetData">
      <wsdl:input message="tns:GetDataSoapIn" />
      <wsdl:output message="tns:GetDataSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="WSCRPL9001Soap" type="tns:WSCRPL9001Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="GetData">
      <soap:operation soapAction="http://tempuri.org/GetData" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="WSCRPL9001Soap12" type="tns:WSCRPL9001Soap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="GetData">
      <soap12:operation soapAction="http://tempuri.org/GetData" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="WSCRPL9001">
    <wsdl:port name="WSCRPL9001Soap" binding="tns:WSCRPL9001Soap">
      <soap:address location="http://172.31.3.48:8717/WS-CRPL-9001.asmx" />
    </wsdl:port>
    <wsdl:port name="WSCRPL9001Soap12" binding="tns:WSCRPL9001Soap12">
      <soap12:address location="http://172.31.3.48:8717/WS-CRPL-9001.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Solution

  • Something seems off with this element. An element that directly references the schema is pretty strange to me - I've never seen such structure:

        <s:element name="GetDataResponse">
            <s:complexType>
                <s:sequence>
                    <s:element minOccurs="0" maxOccurs="1" name="GetDataResult">
                        <s:complexType>
                            <s:sequence>
                                <s:element ref="s:schema" />
                                <s:any />
                            </s:sequence>
                        </s:complexType>
                    </s:element>
                </s:sequence>
            </s:complexType>
        </s:element>
    

    I've validated your WSDL in Eclipse - see what Eclipse says for this WSDL:

    Error resolving component 's:schema'. It was detected that 's:schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'file:///WSDLTEST.wsdl'. If this is the incorrect namespace, perhaps the prefix of 's:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:///WSDL.wsdl'.

    Try removing <s:element ref="s:schema" /> line altogether and see if it works for you. Or describe the sequence element by element the way it's been done for the request GetData.