users@jax-rpc.java.net

Re: JAX-RPC & deserialization error

From: Anne Thomas Manes <anne_at_manes.net>
Date: Wed, 17 Mar 2004 10:34:59 -0500
Teemu,

The problem is caused by namespace errors. JAX-RPC is wroking properly.

According to the WSDL description, the AR-System is producing an invalid message. All child elements of the <{urn:TTM}execute> element are local elements, and therefore they must be unqualified (no namespace prefix) in the document instance. The AR-System is making all child elements qualified.

If it's a challenge to change the way the AR-System generates the XML, you might try specifying the default element form to be qualified. In the <schema> definition add the following:

<schema elementFormDefault="qualified" ...>

Anne

At 12:39 PM 3/15/2004, you wrote:

Hi everybody!

I sent the problem description below to Java Technology Forum
"Java Technologies for Web Services" last week but haven't got
useful replies, so I decided to try here.

I'm having problems with JAX-RPC (JWSDP 1.3 & Tomcat 5.0.18 running on HP-UX).

We have an integration project going on the goal of which is to integrate
a part of our Java-based application with an external AR-System-based
application. We have released some JAX-RPC Web Services, and also written
a testbed using JAX-RPC for system testing purposes.

Everything works well when we access our Web Services using JAX-RPC
clients. But, when the AR-System tries to connect our Web Services, a
deserialization error occurs. A stack trace of the error is in the end
of this message. We are using Document-Literal encoding (AR-System can
handle only literal encodings).

I have ripped the XML contained by the HTTP request from a request
generated by the JAX-RPC clients and from a corresponding request
generated by the AR-System. The XMLs are below:

- XML generated by JAX-RPC client (works):

  <?xml version="1.0" encoding="UTF-8"?>
  <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:ns0="urn:TTM">
    <env:Body>
      <ns0:execute>
        <FindCustomerDataInput_1>
          <areaCode>050</areaCode>
          <customerName>Testuser</customerName>
          <maxAmount>4</maxAmount>
          <password>password</password>
          <queryId>Testqueryid</queryId>
          <systemId>finhd</systemId>
          <telNumber>555555</telNumber>
          <username>username</username>
          <zipCode>02210</zipCode>
        </FindCustomerDataInput_1>
      </ns0:execute>
    </env:Body>
  </env:Envelope>

- XML generated by AR-System (doesn't work):

  <?xml version="1.0" encoding="UTF-8"?>
  <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>
      <ns1:execute xmlns="urn:FindCustomerDataService" xmlns:ns1="urn:TTM"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <ns1:FindCustomerDataInput_1>
          <ns1:areaCode>050</ns1:areaCode>
          <ns1:customerName>testuser</ns1:customerName>
          <ns1:maxAmount>4</ns1:maxAmount>
          <ns1:password>password</ns1:password>
          <ns1:queryId>testqueryid</ns1:queryId>
          <ns1:systemId>finhd</ns1:systemId>
          <ns1:telNumber>555555</ns1:telNumber>
          <ns1:username>username</ns1:username>
          <ns1:zipCode>02210</ns1:zipCode>
        </ns1:FindCustomerDataInput_1>
      </ns1:execute>
    </soapenv:Body>
  </soapenv:Envelope>

The only difference seems to be the way that namespaces are used. The
AR-System's XML is a bit more crappy and unclear, but I'm not able to
see any actual mistakes in it. It's just valid XML, or is it?

Is this a bug in JAX-RPC or is there something wrong with the XML generated
by AR System? Can somebody suggest a solution for this kind of problem?

Here is the WSDL description of the Web Service:

  <?xml version="1.0" encoding="UTF-8"?>

  <definitions name="FindCustomerDataService" targetNamespace="urn:TTM"
      xmlns:tns="urn:TTM" xmlns="http://schemas.xmlsoap.org/wsdl/"  
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"    
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
    <types>
      <schema targetNamespace="urn:TTM" xmlns:tns="urn:TTM"
          xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
          xmlns="http://www.w3.org/2001/XMLSchema">
        <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
        <complexType name="execute">
          <sequence>
            <element name="FindCustomerDataInput_1"
                type="tns:FindCustomerDataInput" nillable="true"/>
          </sequence>
        </complexType>
        <complexType name="FindCustomerDataInput">
          <sequence>
            <element name="areaCode" type="string" nillable="true"/>
            <element name="customerName" type="string" nillable="true"/>
            <element name="maxAmount" type="int" nillable="true"/>
            <element name="password" type="string" nillable="true"/>
            <element name="queryId" type="string" nillable="true"/>
            <element name="systemId" type="string" nillable="true"/>
            <element name="telNumber" type="long" nillable="true"/>
            <element name="username" type="string" nillable="true"/>
            <element name="zipCode" type="string" nillable="true"/>
          </sequence>
        </complexType>
        <complexType name="executeResponse">
          <sequence>
            <element name="result" type="tns:GeneralFinderResponse"
                nillable="true"/>
          </sequence>
        </complexType>
        <complexType name="GeneralFinderResponse">
          <sequence>
            <element name="count" type="int" nillable="true"/>
            <element name="msg" type="string" nillable="true"/>
            <element name="queryId" type="string" nillable="true"/>
          </sequence>
        </complexType>
        <element name="execute" type="tns:execute"/>
        <element name="executeResponse" type="tns:executeResponse"/>
      </schema>
    </types>
    <message name="FindCustomerDataIF_execute">
      <part name="parameters" element="tns:execute"/>
    </message>
    <message name="FindCustomerDataIF_executeResponse">
      <part name="result" element="tns:executeResponse"/>
    </message>
    <portType name="FindCustomerDataIF">
      <operation name="execute">
        <input message="tns:FindCustomerDataIF_execute"/>
        <output message="tns:FindCustomerDataIF_executeResponse"/>
      </operation></portType>
    <binding name="FindCustomerDataIFBinding" type="tns:FindCustomerDataIF">
      <operation name="execute">
        <input>
          <soap:body use="literal"/>
        </input>
        <output>
          <soap:body use="literal"/>
        </output>
        <soap:operation soapAction=""/>
      </operation>
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
          style="document"/>
    </binding>
    <service name="FindCustomerDataService">
      <port name="FindCustomerDataIFPort"
          binding="tns:FindCustomerDataIFBinding">
        <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
      </port>
    </service>
  </definitions>

And here comes the stack trace of the deserialization error:

9.3.2004 10:51:17 com.sun.xml.rpc.server.StreamingHandler handle
SEVERE: deserialization error: unexpected XML reader state. expected: END but found: START: {urn:TTM}FindCustomerDataInput_1

deserialization error: unexpected XML reader state. expected: END but found: START: {urn:TTM}FindCustomerDataInput_1
at com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.deserialize(LiteralObjectSerializerBase.java:101)
at fi.ttmtieto.ttmi.ws.jaxrpc.FindCustomerDataIF_Tie.deserialize_execute(FindCustomerDataIF_Tie.java:106)
at fi.ttmtieto.ttmi.ws.jaxrpc.FindCustomerDataIF_Tie.readFirstBodyElement(FindCustomerDataIF_Tie.java:93)
at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:158)
at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:316)
at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

CAUSE:

unexpected XML reader state. expected: END but found: START: {urn:TTM}FindCustomerDataInput_1
at com.sun.xml.rpc.streaming.XMLReaderUtil.verifyReaderState(XMLReaderUtil.java:49)
at fi.ttmtieto.ttmi.ws.jaxrpc.FindCustomerDataIF_execute_RequestStruct__FindCustomerData__LiteralSerializer.doDeserialize(FindCustomerDataIF_execute_RequestStruct__FindCustomerData__LiteralSerializer.java:55)

at com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.internalDeserialize(LiteralObjectSerializerBase.java:183)

at com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.deserialize(LiteralObjectSerializerBase.java:95)
at fi.ttmtieto.ttmi.ws.jaxrpc.FindCustomerDataIF_Tie.deserialize_execute(FindCustomerDataIF_Tie.java:106)
at fi.ttmtieto.ttmi.ws.jaxrpc.FindCustomerDataIF_Tie.readFirstBodyElement(FindCustomerDataIF_Tie.java:93)
at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:158)
at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:316)
at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:195)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:578)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)

Thanks in advance for your help!

   Teemu Kämäräinen

--
TTM-Tieto Oy
Teemu Kämäräinen
  
GSM: +358 44 700 3227
E-mail: teemu.kamarainen @ ttmtieto.fi

~~~~~~~~~~~~~~~~~~
Anne Thomas Manes
VP & Research Director
Burton Group --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@jax-rpc.dev.java.net For additional commands, e-mail: users-help@jax-rpc.dev.java.net