aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem with Vector Deserialization" Watch "Problem with Vector Deserialization" New topic
Author

Problem with Vector Deserialization

Venkatesh Krishnappa
Greenhorn

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"
xmlns:ns2="http://webservices.com"/>
<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");
cachedSerQNames.add(qName);
cls = java.util.Vector.class;
cachedSerClasses.add(cls);
java.lang.Class vectsf = org.apache.axis.encoding.ser.VectorSerializerFactory.class;
java.lang.Class vectdf = org.apache.axis.encoding.ser.VectorDeserializerFactory.class;
cachedSerFactories.add(vectsf);
cachedDeserFactories.add(vectdf);

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

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.
thanks,
-venky
Venkatesh Krishnappa
Greenhorn

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).

-venky
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Vector Deserialization
 
Similar Threads
XML Schema Problem
Wrapped web service issue
Java Integer Object in Axis - WSDL
Jaxp beginners question.
Null Qualified name .. JAXRPCException while deploying a web service..