Hello,

I have a problem with bean deserialization on the client side of my WS4EE web 
service. I have mapped my custom data types with an ws4ee-deployment.xml 
descriptor. After debugging the server side I learned that everything works 
fine there: the bean serializer and deserializers are found for all beans and 
the messages are properly processed. But on the client side the deserialization 
is not working.

Here are the descriptors:

WSDL:
--------

  | <definitions name="HelloWorldService"  
  |    targetNamespace="http://webservice.hw.de";
  |    xmlns:tns="http://webservice.hw.de"; 
  |    xmlns="http://schemas.xmlsoap.org/wsdl/";  
  |    xmlns:ns2="http://webservice.hw.de/types"; 
  |    xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
  |    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";>
  |   <types>
  |     <schema 
  |       targetNamespace="http://webservice.hw.de/types"; 
  |       xmlns:tns="http://webservice.hw.de/types"; 
  |       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";>
  |       <complexType name="MyBean">
  |         <sequence>
  |           <element 
  |              name="name" 
  |              type="string" 
  |              nillable="true"/>
  |           <element 
  |              name="rollenArray" 
  |              type="tns:Rollen" 
  |              nillable="true" 
  |              minOccurs="0" 
  |              maxOccurs="unbounded"/>
  |           <element 
  |              name="rollenStrings" 
  |              type="string" 
  |              nillable="true" 
  |              minOccurs="0" 
  |              maxOccurs="unbounded"/>
  |          </sequence>
  |       </complexType>
  |       <complexType name="Rollen">
  |         <sequence>
  |           <element 
  |             name="rolle1" 
  |             type="string" 
  |             nillable="true"/>
  |           <element 
  |             name="rolle2" 
  |             type="string" 
  |             nillable="true"/>
  |         </sequence>
  |       </complexType>
  |     </schema>
  |   </types>
  |   <message name="HelloWorldEndpoint_sayBeanHello">
  |     <part name="String_1" type="xsd:string"/>
  |   </message>
  |   <message name="HelloWorldEndpoint_sayBeanHelloResponse">
  |     <part name="result" type="ns2:MyBean"/>
  |   </message>
  |   <portType name="HelloWorldEndpoint">
  |     <operation name="sayBeanHello" parameterOrder="String_1">
  |       <input message="tns:HelloWorldEndpoint_sayBeanHello"/>
  |       <output 
  |         message="tns:HelloWorldEndpoint_sayBeanHelloResponse"/>
  |     </operation>
  |   </portType>
  |   <binding name="HelloWorldEndpointBinding" 
  |      type="tns:HelloWorldEndpoint">
  |     <soap:binding 
  |        transport="http://schemas.xmlsoap.org/soap/http"; 
  |        style="rpc"/>
  |     <operation name="sayBeanHello">
  |       <soap:operation soapAction=""/>
  |       <input>
  |         <soap:body use="literal" 
  |            namespace="http://webservice.hw.de"/>
  |       </input>
  |       <output>
  |         <soap:body use="literal" 
  |            namespace="http://webservice.hw.de"/>
  |       </output>
  |     </operation>
  |   </binding>
  |   <service name="HelloWorldService">
  |     <port name="HelloWorldEndpointPort" 
  |        binding="tns:HelloWorldEndpointBinding">
  |       <soap:address 
  |           location="REPLACE_WITH_ACTUAL_URL"/>
  |     </port>
  |   </service>
  | </definitions>
  | 

WS4EE-DEPLOYMENT:
-------------------------

  | <deployment
  |   xmlns='http://xml.apache.org/axis/wsdd/'
  |   xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
  |   xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
  |   xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
  |   xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
  | 
  |   <typeMapping
  |      qname='tns:Rollen' 
  |      xmlns:tns='http://webservice.hw.de/types'
  |      type='java:de.hw.webservice.Rollen'
  |      serializer='org.jboss.axis.encoding.ser.BeanSerializerFactory'
  |      deserializer='org.jboss.axis.encoding.ser.BeanDeserializerFactory'
  |      encodingStyle=''>
  |   </typeMapping>
  | 
  |   <typeMapping
  |      qname='tns:MyBean' 
  |      xmlns:tns='http://webservice.hw.de/types'
  |      type='java:de.hw.webservice.MyBean'
  |      serializer='org.jboss.axis.encoding.ser.BeanSerializerFactory'
  |      deserializer='org.jboss.axis.encoding.ser.BeanDeserializerFactory'
  |      encodingStyle=''>
  |    </typeMapping>
  | </deployment>
  | 
On the client side the Result bean is not recognized. The stack trace looks 
like this:

DEBUG [BeanDeserializer] onStartChild: rollenArray
DEBUG [DeserializationContextImpl] Enter:getDeserializer: [class=class 
[Lde.hw.webservice.Rollen;,xmlType={http://schemas.xmlsoap.org/soap/encoding/}Array]
DEBUG [DeserializationContextImpl] Exit:getDeserializer: null
DEBUG [BeanDeserializer] Using itemXmlType = null
DEBUG [DeserializationContextImpl] Pushing handler [EMAIL PROTECTED]
DEBUG [DeserializerImpl] Deser got type {http://www.w3.org/2001/XMLSchema}string
DEBUG [DeserializationContextImpl] Enter:getDeserializer: 
[class=null,xmlType={http://www.w3.org/2001/XMLSchema}string]
DEBUG [DeserializationContextImpl] Exit:getDeserializer: [EMAIL PROTECTED]
DEBUG [DeserializationContextImpl] Exit: 
DeserializationContextImpl::startElement()
DEBUG [DeserializationContextImpl] Enter: 
DeserializationContextImpl::startElement(, rolle1)
ERROR [Call] Exception:
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which 
is NOT expected, in something it was trying to deserialize.
at 
org.jboss.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:206)
at 
org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1168)
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.client.Call.invoke(Call.java:2662)
at org.jboss.axis.client.Call.invoke(Call.java:2538)
at org.jboss.axis.client.Call.invokeInternal(Call.java:1976)
at org.jboss.axis.client.Call.invoke(Call.java:1914)
at org.jboss.webservice.client.CallImpl.invoke(CallImpl.java:265)
at org.jboss.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:381)
at $Proxy8.sayBeanHello(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.webservice.client.PortProxy.invoke(PortProxy.java:105)
at $Proxy9.sayBeanHello(Unknown Source)
at 
de.hw.client.WsTestClient.callBeanWsViaEndpointInterface(WsTestClient.java:134)
at de.hw.client.WsTestClient.main(WsTestClient.java:46)

CLIENT:
----------

  | public class WsTestClient {
  |     private static final String WSDL_STRING = 
"http://127.0.0.1:8080/HelloWorld_EJB/HelloWorldEndpoint?wsdl";;
  |     private static final String SERVICE_NAME = "HelloWorldService";
  |     private static final String NAMESPACE_URL = 
"http://webservice.hw.tsystems.de";;
  |     private static final String PORT_NAME = "HelloWorldEndpointPort";
  | 
  |     public static void main(String[] args) {
  |         WsTestClient clientObj = new WsTestClient();
  |         MyBean bean = clientObj.callBeanWsViaEndpointInterface();
  | 
  |         System.out.println("Hello " + bean.getName() + "!");
  |         System.out.println("Rollen: " + bean.getRollenStrings()[0] + ", " +
  |             bean.getRollenStrings()[1]);
  |         System.out.println("Rollen: " + 
bean.getRollenArray()[0].getRolle1() +
  |             ", " + bean.getRollenArray()[0].getRolle2() + ", " +
  |             bean.getRollenArray()[1].getRolle1() + ", " +
  |             bean.getRollenArray()[1].getRolle2());
  |     }
  | 
  |     private MyBean callBeanWsViaEndpointInterface() {
  |         MyBean result = null;
  | 
  |         try {
  |             QName qname = new QName(WsTestClient.NAMESPACE_URL,
  |                     WsTestClient.SERVICE_NAME);
  |             ServiceFactory factory = ServiceFactory.newInstance();
  |             Service service = factory.createService(new URL(
  |                         WsTestClient.WSDL_STRING), qname);
  |             HelloWorldEndpoint hello = (HelloWorldEndpoint) 
service.getPort(HelloWorldEndpoint.class);
  |             result = hello.sayBeanHello("Bean");
  |         } catch (MalformedURLException e) {
  |             e.printStackTrace();
  |         } catch (RemoteException e) {
  |             e.printStackTrace();
  |         } catch (ServiceException e) {
  |             e.printStackTrace();
  |         }
  | 
  |         return result;
  |     }
  | }
  | 

The Rollen array is not deserialized by the BeanSerializer but by the 
SimpleDeserializer. Do I also have to package an ws4ee-deployment descriptor on 
the client side? And if yes: where do I have to copy it when I use a POJO as 
client...

Thanx for your time!

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3881681#3881681

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3881681


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to