0 Replies Latest reply on Apr 28, 2006 1:51 PM by kvbisme

    ws4ee objects serialized out of order

    kvbisme

      So I was putting together a demonstration on using the xsd:extension element in a WSDL, using JBoss 4.0.3SP1 which uses the ws4ee webservices. I created the WSDL which accepted an array of base objects as input. My service took these and using Log4J displayed the classes to demonstrate that you can define a base object and inherit from them in the WSDL.

      This worked fine, until I added a new method to accept a base object and just return it as a base object. Here to demonstrate that it gets sent back correctly. But, it doesn?t. I received the following error:

      Exception in thread "main" java.rmi.RemoteException: Runtime exception; nested exception is:
       unexpected element name: expected=name, actual=fileEntries
       at com.sun.xml.rpc.client.StreamingSender._handleRuntimeExceptionInSend(StreamingSender.java:331)
       at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:313)
       at com.ist.examples.extention.generated.Extention_PortType_Stub.returnBase(Extention_PortType_Stub.java:144)
       at com.ist.examples.extention.client.Client.main(Client.java:62)
      Caused by: unexpected element name: expected=name, actual=fileEntries
       at com.ist.examples.extention.generated.BasicObject_LiteralSerializer.doDeserialize(BasicObject_LiteralSerializer.java:57)
       at com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.internalDeserialize(LiteralObjectSerializerBase.java:216)
       at com.sun.xml.rpc.encoding.literal.LiteralObjectSerializerBase.deserialize(LiteralObjectSerializerBase.java:124)
       at com.ist.examples.extention.generated.BasicObject_InterfaceSOAPSerializer.doDeserialize(BasicObject_InterfaceSOAPSerializer.java:54)
       at com.sun.xml.rpc.encoding.InterfaceSerializerBase.deserialize(InterfaceSerializerBase.java:118)
       at com.ist.examples.extention.generated.Extention_PortType_Stub._deserialize_returnBase(Extention_PortType_Stub.java:207)
       at com.ist.examples.extention.generated.Extention_PortType_Stub._readFirstBodyElement(Extention_PortType_Stub.java:181)
       at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:228)
       ... 2 more


      So after a little research I modify my ws4ee-deployment.xml to specify an ordering of the elements returned since from this message it appears to me that the trouble is that the elements are returned in the wrong order, and after dumping the SOAP messages with Log4J I see that they are the opposite of what I was expecting. So I modified my file from:

      <typeMapping
       xmlns:ns="http://ist.com/examples/extension/v1.0/"
       qname="ns:DirectoryObject"
       type="java:com.ist.examples.extention.generated.DirectoryObject"
       serializer="org.jboss.axis.encoding.ser.BeanSerializerFactory"
       deserializer="org.jboss.axis.encoding.ser.BeanDeserializerFactory"
       encodingStyle=""
       />


      To:
      <typeMapping
       xmlns:ns="http://ist.com/examples/extension/v1.0/"
       qname="ns:DirectoryObject"
       type="java:com.ist.examples.extention.generated.DirectoryObject"
       serializer="org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory"
       deserializer="org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory"
       encodingStyle="">
       <typeDesc xmlType="ns:DirectoryObject">
       <elementOrder>
       <element name="name"/>
       <element name="location"/>
       <element name="fileEntries"/>
       </elementOrder>
       </typeDesc>
       </typeMapping>


      And still the same problem, and after looking at the SOAP message in my log it appears this change had no effect.

      This only happens when I am returning an item of the base type to the client.

      The server and the client were generated with JSWDP 1.6

      Now I reset the mapping file back (which you will see has no bearing) and tried the same test on the 4.0.4CR2 and it works picture perfect. So while the obvious answer is to upgrade to 4.0.4CR2 ? the fact of the matter is I can?t until 4.0.4 is actually released. So ? what can I do?