5 Replies Latest reply on Jun 2, 2007 1:40 PM by 577952

    Error in consuming a (simple) SAP web service

    577952
      Hello,

      I am trying to write a simple web service client for this web service:
      WSDL: http://xi.esworkplace.sap.com:50200/ClassificationService/CS?wsdl
      Endpoint: http://xi.esworkplace.sap.com:50200/ClassificationService/CS?style=document

      When calling the operation getAllClassificationSystems(1, 1, 1, 1) I get the following error:
      An error occurred invoking the specified method.
      ; nested exception is:
           org.xml.sax.SAXException: Invalid element in api_v1.classification.sap.com.ClassificationSystemList - actualCount




      I tested the web service with JCows Generic Web Service Client (http://www.jcows.org/?page=4⟨=de). I also get a similar error when using the Web Service Client Wizard of WebSphere Integration Developer.

      As I can see with TCPmonitor, from the endpoint I receive a meaningful SOAP response like this one:

      SOAP response:
      <SOAP-ENV:Envelope xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity- secext-1.0.xsd">
      <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-u tility-1.0.xsd">
      <wsu:Created>2007-05-16T13:10:10Z</wsu:Created>
      <wsu:Expires>2007-05-16T13:10:40Z</wsu:Expires>
      </wsu:Timestamp>
      </wsse:Security>
      </SOAP-ENV:Header>
      <SOAP-ENV:Body>
      <ns1:ClassificationSystemList version="10736" xmlns:rn0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:rn1="java:sap/standard" xmlns:rn2="urn:uddi-org:vscache_v3" xmlns:rn3="urn:java/lang" xmlns:rn5="urn:uddi-org:api_v3" xmlns:rn4="urn:com.sap.classification.transport" xmlns:ns1="urn:com.sap.classification:api_v1">
      <ns1:listDesc>
      <ns1:actualCount>9</ns1:actualCount>
      <ns1:includedCount>1</ns1:includedCount>
      <ns1:listHead>1</ns1:listHead>
      </ns1:listDesc>
      <ns1:ClassificationSystem valuesVersion="12">
      <ns1:id>uddi:uddi.sap.com:categorization:business-object</ns1:id>
      <ns1:name>Business object</ns1:name>
      <ns1:description>The SAP business object UDDI category system and SR classification system. Business objects are part of the Enterprise Service Architecture meta-model.</ns1:description>
      <ns1:type>FLAT</ns1:type>
      <ns1:isPredifined>true</ns1:isPredifined>
      <ns1:readOnly>false</ns1:readOnly>
      <ns1:onlyOnce>false</ns1:onlyOnce>
      <ns1:mustHaveDesc>false</ns1:mustHaveDesc>
      <ns1:normalizeCodes>false</ns1:normalizeCodes>
      <ns1:mTimeCustModService>true</ns1:mTimeCustModService>
      <ns1:mTimeSapModService>true</ns1:mTimeSapModService>
      <ns1:ideCusModService>true</ns1:ideCusModService>
      <ns1:ideCustPrgService>true</ns1:ideCustPrgService>
      <ns1:ideSapModService>true</ns1:ideSapModService>
      <ns1:ideSapPrgService>true</ns1:ideSapPrgService>
      </ns1:ClassificationSystem>
      </ns1:ClassificationSystemList>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>




      This is how the submitted SOAP request looks like:

      SOAP request:
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <getAllClassificationSystems xmlns="urn:com.sap.classification:api_v1">
      <listHead xsi:type="xsd:int">1</listHead>
      <maxRows xsi:type="xsd:int">1</maxRows>
      <version xsi:type="xsd:long">1</version>
      <sortType xsi:type="xsd:int">1</sortType>
      </getAllClassificationSystems>
      </soapenv:Body>
      </soapenv:Envelope>



      But the problem is meet when the client tries to deserialize the received SOAP response. The error message in WID looks like this:

      Error message:
      WebServicesFault
      faultCode: hxxp://schemas.xmlsoap.org/soap/envelope/ Server.generalException
      faultString: org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element actualCount of bean classification.api_v1.sap.com.ClassificationSystemList_Type.
      Child element actualCount does not belong in namespace urn:com.sap.classification:api_v1.
      Most likely, a third-party web services platform has sent an incorrect SOAP message.
      faultActor: null
      faultDetail:

      org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element actualCount of bean classification.api_v1.sap.com.ClassificationSystemList_Type.
      Child element actualCount does not belong in namespace urn:com.sap.classification:api_v1.
      Most likely, a third-party web services platform has sent an incorrect SOAP message.
           at com.ibm.ws.webservices.engine.WebServicesFault.makeFault(WebServicesFault.java: 203)
           at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1055)
           at com.ibm.ws.webservices.engine.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:605)
           at com.ibm.ws.webservices.engine.Message.getSOAPEnvelope(Message.java:461)
           at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCSOAPHandler.checkSOAPSemant ics(JAXRPCSOAPHandler.java:298)
           at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCSOAPHandler.access$000(JAXR PCSOAPHandler.java:75)
           at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCSOAPHandler$2.invoke(JAXRPC SOAPHandler.java:173)
           at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.ja va:329)
           at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:2 83)
           at com.ibm.ws.webservices.engine.client.Connection.invokeEngine(Connection.java:79 8)
           at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:693)
           at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:644)
           at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:472)
           at com.ibm.ws.webservices.engine.client.Stub$Invoke.invoke(Stub.java:818)
           at ClassificationServiceWsd.CSBindingStub.getAllClassificationSystems(CSBindingStu b.java:127)
           at ClassificationServiceWsd.ClassificationServiceViProxy.getAllClassificationSyste ms(ClassificationServiceViProxy.java:64)
           at temp.CsReader3.main(CsReader3.java:42)
      Caused by: org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element actualCount of bean classification.api_v1.sap.com.ClassificationSystemList_Type.
      Child element actualCount does not belong in namespace urn:com.sap.classification:api_v1.
      Most likely, a third-party web services platform has sent an incorrect SOAP message.
           at com.ibm.ws.webservices.engine.encoding.ser.BeanDeserializer.onStartChild(BeanDe serializer.java:359)
           at com.ibm.ws.webservices.engine.events.DEventProcessor.onSimpleChild(DEventProces sor.java:240)
           at com.ibm.ws.webservices.engine.encoding.ser.BeanDeserializer.onSimpleChild(BeanD eserializer.java:576)
           at com.ibm.ws.webservices.engine.events.P2DConverter.flush(P2DConverter.java:767)< br>     at com.ibm.ws.webservices.engine.events.P2DConverter.endElement(P2DConverter.java: 410)
           at sax.SAX2DocumentEntityParserBase.endElementAction(Unknown Source)
           at util.DocumentEntityParserBase.endElementEvent(Unknown Source)
           at com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanEndElement(Unknown Source)
           at com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanContent(Unknown Source)
           at com.ibm.xml.b2b.scan.latin.LatinWFCDocumentScanner.scanDocument(Unknown Source)
           at sax.latin.LatinWFCSAX2DocumentEntityParser.scanDocument(Unknown Source)
           at util.DocumentEntityParserBase.parse(Unknown Source)
           at sax.SAX2DocumentEntityParserBase.parseEntity(Unknown Source)
           at sax.SAX2DocumentEntityParserBase.parse(Unknown Source)
           at javax.xml.parsers.SAXParser.parse(Unknown Source)
           at com.ibm.ws.webservices.engine.utils.WebServicesParser.parse(WebServicesParser.j ava:274)
           at com.ibm.ws.webservices.engine.encoding.DeserializationContextImpl.parse(Deseria lizationContextImpl.java:268)
           at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1029)
           ... 15 more



      Are the generated proxies for the web service client erronous, and thus a problem with Axis WSDL2Java tooling exists?
      Or is there a mismatch between WSDL and SOAP response concerning encoding style or namespaces, or other...

      Thanks for some hints!
        • 1. Re: Error in consuming a (simple) SAP web service
          Eric Rajkovic-Oracle
          If I understand the WSDL correctly, the response for the getAllClassificationSystems operation should be an element named "Response"
          ...
                <xs:element name="ClassificationSystemList">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element name="Response" type="tns:ClassificationSystemList"
                                  nillable="true"/>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
          ...
            <wsdl:message name="getAllClassificationSystemsOut_doc">
              <wsdl:part name="parameters" element="ns0:ClassificationSystemList"/>
            </wsdl:message>
          ...
          This is missing from the payload
          ...
             <SOAP-ENV:Body xmlns:rpl="urn:com.sap.classification:api_v1">
                <rpl:ClassificationSystemList version="10954" xmlns:rn0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:rn1="java:sap/standard" xmlns:rn2="urn:uddi-org:vscache_v3" xmlns:rn3="urn:java/lang" xmlns:rn5="urn:uddi-org:api_v3" xmlns:rn4="urn:com.sap.classification.transport">
                   <rpl:listDesc>
                      <rpl:actualCount>9</rpl:actualCount>...
          you may be facing an issue with document-literal-bare vs document-literal-wrapped.

          You should contact your SAP partner or go with a no-data-binding option, where you would handled response as POX (Plain Old XML).

          Hope it helps,
          -Eric
          • 2. Re: Error in consuming a (simple) SAP web service
            Eric Rajkovic-Oracle
            I should have included a possible work-around: modify the WSDL to match with the wire format if you don't have access to the remote service.
            ...
                  <xs:element name="ClassificationSystemList">
                    <xs:complexType>
                      <xs:sequence>
                        <xs:element name="listDesc" type="tns:ListDescription"
                                    nillable="true" minOccurs="0"/>
                        <xs:element name="ClassificationSystem" maxOccurs="unbounded"
                                    minOccurs="0" type="tns:ClassificationSystem"
                                    nillable="true"/>
                      </xs:sequence>
                      <xs:attribute name="version" type="xs:long" use="required"/>
            <!--
                      <xs:sequence>
                        <xs:element name="Response" type="tns:ClassificationSystemList"
                                    nillable="true"/>
                      </xs:sequence>
            -->
                    </xs:complexType>
                  </xs:element>
            ...
            Hope it helps,
            -Eric
            • 3. Re: Error in consuming a (simple) SAP web service
              577952
              I should have included a possible work-around: modify
              the WSDL to match with the wire format if you don't
              have access to the remote service.
              ...
              <xs:element name="ClassificationSystemList">
              <xs:complexType>
              <xs:sequence>
              <xs:element name="listDesc"
              type="tns:ListDescription"
              nillable="true"
              minOccurs="0"/>
              <xs:element name="ClassificationSystem"
              maxOccurs="unbounded"
              minOccurs="0"
              type="tns:ClassificationSystem"
              nillable="true"/>
              
              <xs:attribute name="version" type="xs:long"
              use="required"/>
              !--
              <xs:sequence>
              <xs:element name="Response"
              type="tns:ClassificationSystemList"
              nillable="true"/>
              >
              --> </xs:complexType> xs:element> ...
              Hope it helps,
              -Eric
              erajkovi,

              thanks for your suggestion. Since I have no access to the remote service I have modified the WSDL file, as you suggested.
              But now I am encountering another error when invoking the operation:
              WebServicesFault
               faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
               faultString: No operation found using soap keys [], [getAllClassificationSystems]. InterfaceMapping Object class: com.sap.engine.services.webservices.espbase.mappings.InterfaceMapping mappings: {BindingType=Soap, InterfaceMappingID=sap.com/tc~classificationService_ClassificationService_CSPort}.
               faultActor: null
               faultDetail: 
                   com.sap.engine.services.webservices.espbase.server.additions.exceptions.ProcessException: No operation found using soap keys [], [getAllClassificationSystems]. InterfaceMapping Object class: com.sap.engine.services.webservices.espbase.mappings.InterfaceMapping mappings: {BindingType=Soap, InterfaceMappingID=sap.com/tc~classificationService_ClassificationService_CSPort}.
              
              No operation found using soap keys [], [getAllClassificationSystems]. InterfaceMapping Object class: com.sap.engine.services.webservices.espbase.mappings.InterfaceMapping mappings: {BindingType=Soap, InterfaceMappingID=sap.com/tc~classificationService_ClassificationService_CSPort}.
                   at com.ibm.ws.webservices.engine.WebServicesFault.makeUserFault(WebServicesFault.java:218)
                   at com.ibm.ws.webservices.engine.xmlsoap.builders.WebServicesFaultProcessor.createFault(WebServicesFaultProcessor.java:411)
                   at com.ibm.ws.webservices.engine.xmlsoap.SOAPFault.getFault(SOAPFault.java:486)
              ...
              I noticed that the generated SOAP request now has also changed. The getAllClassificationSystems element is now wrapped with an additional getAllClassificationSystems element. So the web service endpoint is not able to understand the message.
              <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                 <soapenv:Header/>
                 <soapenv:Body>
                    <getAllClassificationSystems>
                       <p970:getAllClassificationSystems xmlns:p970="urn:com.sap.classification:api_v1">
                          <p970:listHead>1</p970:listHead>
                          <p970:maxRows>10</p970:maxRows>
                          <p970:version>1</p970:version>
                          <p970:sortType>1</p970:sortType>
                       </p970:getAllClassificationSystems>
                    </getAllClassificationSystems>
                 </soapenv:Body></soapenv:Envelope>
              The generated proxies by WSDL2Java are now different. Previously I invoked the operation in this way:
              proxy.getAllClassificationSystems(new Integer(1), new Integer(1), new Long(1), new Integer(1));
              Now I must invoke it so:
              GetAllClassificationSystems gas = new GetAllClassificationSystems();        
                      gas.setListHead(new Integer(1));
                      gas.setMaxRows(new Integer(10));
                      gas.setSortType(new Integer(1));
                      gas.setVersion(new Long(1));                 
                      proxy.getAllClassificationSystems(gas);
              Is there a possbility to configure Axis WSDL2Java in order to create the previous SOAP message or is another change to the WSDL required?
              • 4. Re: Error in consuming a (simple) SAP web service
                Eric Rajkovic-Oracle
                Make sure that you did modify the XML schema for the output message -- the second one in the snippet below.
                  <wsdl:message name="getAllClassificationSystemsIn_doc">
                    <wsdl:part name="parameters" element="ns0:getAllClassificationSystems"/>
                  </wsdl:message>
                  <wsdl:message name="getAllClassificationSystemsOut_doc">
                    <wsdl:part name="parameters" element="ns0:ClassificationSystemList"/>
                  </wsdl:message>
                The fact you have changed the format of the request let me thing that you have change the definition of getAllClassificationSystems instead of ClassificationSystemList.

                I did test my proposed changed with JDevevloper 11G tech Preview, using the JAX-RPC based client, and it worked fine.

                I am not too familiar with Axis tools, so I can't help much. Sorry.

                -Eric
                • 5. Re: Error in consuming a (simple) SAP web service
                  577952
                  Eric,

                  thx a bunch for your help.
                  The problem simply consist in a mismatch between the WSDL and the web service endpoint. I am now trying to get an updated WSDL file.