You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rhimbo <rh...@yahoo.com> on 2006/05/19 04:21:40 UTC

How to serialize this class?

HI folks,

I defined a Java Bean, called FamilyData:

The important snippet is below, showing the four class members:

public class FamilyData
{
  ...

  protected int familyId; 
  protected String description; 
  protected int [] memberIds;
  protected String [] memberUsernames;

  ...
}


I do have getter and setter methods to make the class a proper Java
Bean... full file is attached instead of included inline to make
reading this email easier. 

I've also attached the Java client code that's making the call. 

Here is my WSDD file:

<deployment xmlns="http://xml.apache.org/axis/wsdd/"
  xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
  <service name="disFamilyManagement" provider="java:RPC">

    <namespace>http://family.dis.disney</namespace>

    <parameter name="className" value="disney.dis.family.FamilyManager"/>
    <parameter name="allowedMethods" value="*"/>
    <parameter name="scope" value="application"/>

    <beanMapping qname="ns:DISResult" xmlns:ns="http://dis.disney"
      languageSpecificType="java:disney.dis.DISResult"/>

    <beanMapping qname="ns:FamilyData"
xmlns:ns="http://family.dis.disney"
      languageSpecificType="java:disney.dis.family.FamilyData"/>

  </service>
</deployment>



I want to pass an instance as the return type of a web service end
point call.

I'm guessing the problem has to do with serialization/deserialization
but not sure.

Here is the exception I'm getting:

; nested exception is:
        org.xml.sax.SAXParseException: Premature end of file.
AxisFault
 faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: org.xml.sax.SAXParseException: Premature end of file.
 faultActor:
 faultNode:
 faultDetail:
       
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException:
Premature end of file.
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
        at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
        at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
        at
com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230)
        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798)
        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
        at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:226)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
        at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:173)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
        at org.apache.axis.client.Call.invoke(Call.java:2702)
        at org.apache.axis.client.Call.invoke(Call.java:2378)
        at org.apache.axis.client.Call.invoke(Call.java:2301)
        at org.apache.axis.client.Call.invoke(Call.java:1758)




My question is: do I have to set a serializer and deserializer on the
call object?  How do I do that?  I already have a
BeanSerializerFactory and BeanDeserializerFactory set on the call.

1. Can I set several serializers on the same call 
   - the BeanSerializerFactory and BeanDeserializerFactory
   - ArraySerializer and ArrayDeserializer 

2. What are the arguments in the ArraySerializer class?

   public ArraySerializer(java.lang.Class javaType,
                          QName xmlType,
                          QName componentType)

   - What's the class for an array?
   - What's the second arg -- something like:
       new QName("http://family.dis.disney", "array");
   - What's the component QName (third arg)? 

3. Is there an array deserializer? 

4. Am I completely off-base?  


Many thanks,

Vartan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com