• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Vector Deserialization

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
If you look closely at this tiny ad, you will see five bicycles and a naked woman:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic