JAX- RPC : Getting error "org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element"

2.7k views Asked by At

On trying to modify an existing wsdl and changing the Request Type and Response Type of an operation I am getting the below.

The process I followed is : 1. Modify the xsd 2. Generate Java Bean Skeleton (Can not change it as it is referred in multiple places)

Fixes tried : 1. Referred to multiple articles and have changed the WSDL to be elementFormDefault="unqualified" and to regenerate the supporting files. 2. I have tried to set xmlns="" to disable namespace for the field.

WSDL (Pasting just the modified operation, the original wswdl has around 52 operations)

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="ABCDEF" targetNamespace="http://managemyxyz.services.abc.def/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://managemyabc.services.abc.def/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://cat.abc.def/ABC/schema/">

    <wsdl:types>
    <xsd:schema targetNamespace="http://manageabc.services.abc.def/">
      <xsd:complexType name="NewType"/>
    </xsd:schema>
        <xsd:schema>
            <xsd:import namespace="http://cat.abc.def/ABC/schema/" schemaLocation="xsd/ABC.xsd">
            </xsd:import>
    </xsd:schema>

  <wsdl:message name="insertABCRequest">
    <wsdl:part name="insertABCRequest" type="xsd1:InsertABCItemRequestType"/>
  </wsdl:message>
  <wsdl:message name="insertABCItemResponse">
    <wsdl:part name="insertABCItemResponse" type="xsd1:InsertABCItemResponseType"/>
  </wsdl:message>
  <wsdl:portType name="ABCDEF">
    <wsdl:operation name="insertABC">
        <wsdl:input message="tns:insertABCItemRequest1"/>
        <wsdl:output message="tns:insertABCItemResponse1"/>
    </wsdl:operation>
  </wsdl:portType>
<wsdl:binding name="ABCSOAP" type="tns:ABC">
        <wsdl:operation name="insertABC">

    <soap:operation soapAction="http://manageabc.services.abc.def/insertABC"/>
    <wsdl:input>

        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output>

        <soap:body use="literal"/>
    </wsdl:output>
</wsdl:operation>
</wsdl:binding>
 <wsdl:service name="ABC">
<wsdl:port binding="tns:ABCSOAP" name="ABCSOAP">
  <soap:address location="http://localhost:10039/.modulename.war/services/ABCSOAP"/>
</wsdl:port>

ABC.xsd

<element name="InsertABCRequest" type="Q1:InsertABCItemRequestType">
</element>

<complexType name="InsertABCItemRequestType">
    <sequence>
        <element name="abcdId" type="int"/>
        <element name="abcdCode" type="string"/>
        <element name="abcNumber" type="string"/>
    </sequence>
</complexType>
<element name="InsertABCItemResponse" type="Q1:InsertABCItemResponseType">
</element>

<complexType name="insertABCItemResponse">
    <sequence>
        <element name="responseHeader" type="Q1:ResponseCodeType"/>
    </sequence>
</complexType>

Exception :

[11/28/14 13:21:20:240 IST] 000000af WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet doPost WSWS3227E:  Error: Exception:
                         WebServicesFault



faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultString: org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element fieldName of bean com.abc.xyz.abc.InsertABCRequestType. 
Child element fieldName does not belong in namespace . 
Most likely, a third party web services platform has sent an incorrect SOAP message. Message being parsed: 
 faultActor: null
 faultDetail: 

org.xml.sax.SAXException: WSWS3047E: Error: Cannot deserialize element fieldName of bean com.abc.xyz.abc.InsertABCRequestType.
Child element InsertABCRequestType does not belong in namespace . 
Most likely, a third party web services platform has sent an incorrect SOAP message. Message being parsed: 
    at com.ibm.ws.webservices.engine.WebServicesFault.makeFault(WebServicesFault.java:300)
    at com.ibm.ws.webservices.engine.SOAPPart._getSOAPEnvelope(SOAPPart.java:1090)
    at com.ibm.ws.webservices.engine.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:628)
    at com.ibm.ws.webservices.engine.SOAPPart.getEnvelope(SOAPPart.java:656)
    at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandlerChain.handleRequest(JAXRPCHandlerChain.java:301)
    at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler.invokeServerRequestHandler(JAXRPCHandler.java:516)
    at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler$1.invoke(JAXRPCHandler.java:381)
    at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:225)
    at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:336)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:1246)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:738)
    at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:344)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)

Environment Details :

Server : IBM WAS 7.0.0.31 IDE : IBM RAD 8.5

Please let me know if any other information is required.

1

There are 1 answers

0
Debarshi DasGupta On BEST ANSWER

@BK Elizabeth - thank you for your response. As per the current implementation it is the wsdl that is used to generate the java beans using top down approach instead of bottom up approach you referred to in your comment (no doubt that is a better approach).

The real problem was that the generated beans are added at the container level as a shared lib since objects of the beans are passed between multiple modules. So even though I was updating the beans at module level but actually a previous version of the service beans were loaded. On updating the shared lib my changes started reflecting and the error "WSWS3047E: Error: Cannot deserialize element" got resolved".


For "WSWS3047E: Error: Cannot deserialize element" error below mentioned link can be referred, though my problem was bit different problem.

http://www-01.ibm.com/support/docview.wss?uid=swg21220377