| | |
Serialization/Deserialization Error
![]() |
•
•
Join Date: Dec 2008
Posts: 6
Reputation:
Solved Threads: 0
Hi..my aim is to serialize/deserialize my "SoapPair" class , that contains Axis MessageContext obj (SoapPair receives this from its constructor), not serializable object(when trying to normally serialize , it returns "axis MessageContext not serializable")..
How do I serialize/deser the SoapPair class?
Do I have to use SerializationContext/Deser context? How?
Thanks in Advance.
How do I serialize/deser the SoapPair class?
Do I have to use SerializationContext/Deser context? How?
Thanks in Advance.
•
•
Join Date: Dec 2008
Posts: 6
Reputation:
Solved Threads: 0
I'll show you the skeleton of SoapPair class. It receives from the constructor an Axis MessageContext (it's not manadatory...)..and from it divides the Soap message into header+body (2 get methods).
My aim is to serialize that class from a test main , using the 2 methods deserialize/serialized that I should override in the class.
My aim is to serialize that class from a test main , using the 2 methods deserialize/serialized that I should override in the class.
Java Syntax (Toggle Plain Text)
public class SoapPair{ public SoapPair(org.apache.axis.MessageContext mc) {} public Message getLeft(){ return leftmsg } public Message getRight(){ return rightmsg; } protected void _serialize(final OutputStream out) throws PostException { } public Message deSerialize(final InputStream in) throws PostException { }
You need to mark the field of type
But given that if the
MessageContext as transient so that the serialization mechanism doesn't attempt to serialize it. This only works if the state of the MessageContext has no significance whatsoever to the newly reconstituted SoapPair object. If it does, then you have to manually write out the state of the MessageContext object for which you will have to provide an implementation for readObject and writeObject methods for your SoapPair class.But given that if the
MessageContext class isn't Serializable , there might be a good reason behind it. Are you sure the MessageContext instance *really* constitutes the state of your SoapPair object? Also given that any context logically belongs to a given environment, serializing it or clubbing it with something which is meant to be serialized doesn't make much sense. Last edited by ~s.o.s~; Dec 17th, 2008 at 9:47 am.
I don't accept change; I don't deserve to live.
I haven't worked with Axis so wouldn't know the context involved but like I previously suggested, either mark the field as
transient or implement your own readObject and writeObject methods to get around the restriction. Search for 'serialization java' with the search engine of your choice and you should find something to get you started. I don't accept change; I don't deserve to live.
![]() |
Other Threads in the Java Forum
- Previous Thread: missing return statement prob
- Next Thread: Cone Formula
| Thread Tools | Search this Thread |
account android api applet application array arrays automation bidirectional binary birt bluetooth class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors exception expand fractal game givemetehcodez graphics gui guidancer homework html ide image inetaddress inheritance integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux list loop map method methods midlethttpconnection mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program project property recursion ria scanner search server set sharepoint smart sms smsspam sort sourcelabs splash sql sqlite static string subclass support swing testautomation threads tree unlimited webservices windows






