wood burning stoves
The moose likes Web Services and the fly likes Problem with Vector Deserialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem with Vector Deserialization" Watch "Problem with Vector Deserialization" New topic

Problem with Vector Deserialization

Venkatesh Krishnappa

Joined: May 26, 2003
Posts: 16
I have a deserialization issue here:
Let me explain what Iam doing here ... I have axis 1.1 RC1 on both server and client ends.
My web service is returning a bean Object of type LoginData.
LoginData has three member variables of type MercuryMsg (which is again a bean).
MercuryMsg has a member variable of type java.util.Vector.
My server_config.wsdd has a typemapping as defined here:
<typeMapping encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" serializer="org.apache.axis.encoding.ser.Vector
SerializerFactory" deserializer="org.apache.axis.encoding.ser.VectorDeserializerFactory" type="java:java.util.Vector" q
name="ns1:Vector" xmlns:ns1="http://java.sun.com/jax-rpc-ri/internal"/>
<beanMapping languageSpecificType="java:com.webservices.LoginData" qname="ns2:LoginData"
<beanMapping languageSpecificType="java:com.webservices.MercuryMsg" qname="ns3:MercuryMs
g" xmlns:ns3="http://webservices.com"/>

The client registers the Vector serializer as follows:
qName = new javax.xml.namespace.QName("http://java.sun.com/jax-rpc-ri/internal", "Vector");
cls = java.util.Vector.class;
java.lang.Class vectsf = org.apache.axis.encoding.ser.VectorSerializerFactory.class;
java.lang.Class vectdf = org.apache.axis.encoding.ser.VectorDeserializerFactory.class;

and my wsdl generated by Java2WSDL looks like this :
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://webservices.com">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="LoginData">
<element name="entitlements" nillable="true" type="impl:MercuryMsg"/>
<element name="settings" nillable="true" type="impl:MercuryMsg"/>
<element name="profile" nillable="true" type="impl:MercuryMsg"/>
<complexType name="MercuryMsg">
<element name="fields" nillable="true" type="apachesoap:Vector"/>
<element name="LoginData" nillable="true" type="impl:LoginData"/>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.apache.org/xml-soap">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Vector">
<element name="item" minOccurs="0" maxOccurs="unbounded" type="xsd:anyType"/>

when I run my client, Iam getting this following error:
org.apache.jasper.JasperException: ; nested exception is:
org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

when my web service returns a Vector directly, then the above configuration works fine. But it fails when a Vector is
contained by another object like MercuryMsg.
Any help will be greatly appreciated.
Venkatesh Krishnappa

Joined: May 26, 2003
Posts: 16
I could fix this problem. The problem was, typemapping was missing for the object MercuryMsgField, which was a member variable in MercuryMsg. Since the Vector contained MercuryMsg elements, I had to add typemapping for MercuryMsg and the objects it contained (nesting).

I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with Vector Deserialization
It's not a secret anymore!