| | |
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 |
addball android api applet application apps array arrays automation awt binary bluetooth businessintelligence busy_handler(null) button card chat class client code collision component constructor crashcourse css database draw eclipse ee error eventlistener exception fractal free game gis givemetehcodez graphics gui html ide image integer integration j2me java javadoc javafx javamicroeditionuseofmotionsensor javaprojects jni jpanel jtree julia jvm linux list loan machine map method methods migrate mobile netbeans newbie oracle output phone physics plazmic problem program programming project radio recursion scanner server service set sharepoint smart sms socket software sort sortedmaps sql string swing textfield threads transfer tree trolltech unlimited utility webservices windows






