1 Reply Latest reply on Oct 29, 2005 5:19 PM by Samuel Ventura

    dynamic axis serializer generation fails on 4.0.2+EJB3RC2

    Samuel Ventura Newbie

      I am experimenting a very peculiar issue with axis webservices on jboss 4.0.2.

      This is my interface

      package test;
      
      import java.rmi.Remote;
      import java.rmi.RemoteException;
      
      import java.util.*;
      
      public interface Test
       extends Remote
      {
       TestPojo[] test(TestPojo[] pojos)
       throws RemoteException;
      }


      This is the implementation
      package test;
      
      import java.rmi.RemoteException;
      import javax.xml.rpc.*;
      import javax.xml.rpc.server.ServiceLifecycle;
      
      import java.util.*;
      
      public class TestImpl
       implements Test, ServiceLifecycle
      {
       public TestPojo[] test(TestPojo[] pojos)
       {
       return pojos;
       }
      
       ////////////////////////////////////////////////////////////////////////////
       // AUTOGENERATED STUB
       ////////////////////////////////////////////////////////////////////////////
       public void init(Object arg0) throws ServiceException
       {
       }
      
       public void destroy()
       {
       }
      }


      This is ant task used to generate wsdl

      <axis-java2wsdl
       classname="test.Test"
       style="RPC"
       serviceportname="TestPort"
       namespace="http://test"
       location="http://localhost:8080/test/Test"
       output="${build.dir}/wsdl/TestService.wsdl">
       <classpath>
       <pathelement path="${build.dir}/classes"/>
       </classpath>
       </axis-java2wsdl>


      This is my jaxrpc-mapping.xml

      <package-mapping>
       <package-type>test</package-type>
       <namespaceURI>http://test</namespaceURI>
       </package-mapping>


      web.xml and webservices.xml are not show but are ok because it deploys.

      I donot explicitly declare a serializar for TestPojo.

      I get this exception when method is invoked :

      2005-10-26 22:09:41,632 ERROR [org.jboss.axis.providers.java.RPCInvocation] org.xml.sax.SAXException: No deserializer defined for array type {http://test}TestPojo
      org.xml.sax.SAXException: No deserializer defined for array type {http://test}TestPojo
       at org.jboss.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeserializer.java:331)
       at org.jboss.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:466)
       at org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1182)
       at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
       at org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1386)
       at org.jboss.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:436)
       at org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1182)
       at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
       at org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1386)
       at org.jboss.axis.message.RPCElement.deserialize(RPCElement.java:262)
       at org.jboss.axis.message.RPCElement.getParams(RPCElement.java:396)
       at org.jboss.axis.providers.java.RPCInvocation.prepareFromRequestEnvelope(RPCInvocation.java:235)
       at org.jboss.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:103)
       at org.jboss.axis.providers.java.JavaProvider.invoke(JavaProvider.java:358)
       at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
       at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
       at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
       at org.jboss.axis.handlers.soap.SOAPService.invoke(SOAPService.java:560)
       at org.jboss.webservice.server.ServerEngine.invokeInternal(ServerEngine.java:200)
       at org.jboss.webservice.server.ServerEngine.invoke(ServerEngine.java:89)
       at org.jboss.axis.transport.http.AxisServlet.doPost(AxisServlet.java:905)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.jboss.axis.transport.http.AxisServletBase.service(AxisServletBase.java:370)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      2005-10-26 22:09:41,654 ERROR [org.jboss.webservice.server.ServerEngine] Server error: AxisFault
       faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
       faultSubcode:
       faultString: No deserializer defined for array type {http://test}TestPojo
       faultActor:
       faultNode:
       faultDetail:
       {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException: No deserializer defined for array type {http://test}TestPojo
       at org.jboss.axis.encoding.ser.ArrayDeserializer.onStartElement(ArrayDeserializer.java:331)
       at org.jboss.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:466)
       at org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1182)
       at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
       at org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1386)
       at org.jboss.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:436)
       at org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1182)
       at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
       at org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1386)
       at org.jboss.axis.message.RPCElement.deserialize(RPCElement.java:262)
       at org.jboss.axis.message.RPCElement.getParams(RPCElement.java:396)
       at org.jboss.axis.providers.java.RPCInvocation.prepareFromRequestEnvelope(RPCInvocation.java:235)
       at org.jboss.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:103)
       at org.jboss.axis.providers.java.JavaProvider.invoke(JavaProvider.java:358)
       at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
       at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
       at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
       at org.jboss.axis.handlers.soap.SOAPService.invoke(SOAPService.java:560)
       at org.jboss.webservice.server.ServerEngine.invokeInternal(ServerEngine.java:200)
       at org.jboss.webservice.server.ServerEngine.invoke(ServerEngine.java:89)
       at org.jboss.axis.transport.http.AxisServlet.doPost(AxisServlet.java:905)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.jboss.axis.transport.http.AxisServletBase.service(AxisServletBase.java:370)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      
       {http://xml.apache.org/axis/}isRuntimeException: true
      
      2005-10-26 22:09:41,656 INFO [org.jboss.axis.transport.http.AxisServlet] org.xml.sax.SAXException: No deserializer defined for array type {http://test}TestPojo



      My surprise it that if test method is changed to (array operator removed from either parameter or return type, it does not matter):

      TestPojo test(TestPojo[] pojos)
       throws RemoteException;
      


      then it works!!!

      My conclusion is that TestPojo must be explicitly referenced on the given interface so that axis auto generates a serializer/deserializer for it. Arrays does not seem to count as explicit references.

      Is this a bug?

      Any comments will be apreciated since I donot want to put explicit references of all involved pojos (with dummy methods) just to workaround this.

      Regards






        • 1. Re: dynamic axis serializer generation fails on 4.0.2+EJB3RC
          Samuel Ventura Newbie

          By the way, axis fails to properly serialize agregated arrays on server side if POJO is declared with field access level.

          For example, it serializes an String[] as if it were a single String object but multiple times (multiplicitly is coincident)

          If POJO is declared with method level access (private fields), then it works as expected.


          This works

          public class POJO
          {
           String[] strings;
           public String[] getStrings()
           {
           return strings;
           public void setStrings(String[] strings)
           {
           this.strings = strings;
           }
          }


          This does NOT work


          public class POJO
          {
           public String[] strings;
          }


          @REMEBERNOTE
          Update this post with the tcpmon captured packages for both cases.


          Looks like a punishment for lazy people like my self :-).

          It is also interesting to note that auto generated client code(axis-wsdl2java) does not explicitly fails on this behavior, it just deserializes wrongly.

          This problem was first dicovered when testing with a .net client.