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 Ric Searle <ri...@dialogue.co.uk> on 2003/09/30 15:05:58 UTC

Serializing a SOAPEnvelope

Hi,

Just a quick one about serialization:

I have a SOAPEnvelope object, which I want to write to disk to be 
processed later.  I thought that serializing it would be a  nice idea.  
I'm serializing it like this:

		FileOutputStream fos = new FileOutputStream(outFile);
         ObjectOutputStream oos = new ObjectOutputStream(fos);

         oos.writeObject(soapEnvelope);

         oos.close();
         fos.flush();
         fos.close();


But when I deserialize it by doing this...

		ObjectInputStream ois = new ObjectInputStream(fis);
         SOAPEnvelope soapEnvelope = (SOAPEnvelope) ois.readObject();
         ois.close();

...the structure of the original SOAP message is there, but none of the 
content is recovered.

What am I doing wrong?

Regards,

Ric Searle


Re: Serializing a SOAPEnvelope

Posted by Srinath Perera <he...@vijayaba.cse.mrt.ac.lk>.
Hi Ric 

try this

Writer w = new Writer(); //create some kind of writer
org.apache.axis.encoding.SerializationContest sc = new
		org.apache.axis.encoding.SerializationContestImpl(w);
SOAPEnvelope env = new SOAPEnvelope();
env.output(sc);

if the content (object value for your SOAPEnvelope has serializer's
registered it should be written.)

pls check the spelling for SerializationContest :)

hop this help 

Srianth



On Tue, 2003-09-30 at 19:05, Ric Searle wrote:
> Hi,
> 
> Just a quick one about serialization:
> 
> I have a SOAPEnvelope object, which I want to write to disk to be 
> processed later.  I thought that serializing it would be a  nice idea.  
> I'm serializing it like this:
> 
> 		FileOutputStream fos = new FileOutputStream(outFile);
>          ObjectOutputStream oos = new ObjectOutputStream(fos);
> 
>          oos.writeObject(soapEnvelope);
> 
>          oos.close();
>          fos.flush();
>          fos.close();
> 
> 
> But when I deserialize it by doing this...
> 
> 		ObjectInputStream ois = new ObjectInputStream(fis);
>          SOAPEnvelope soapEnvelope = (SOAPEnvelope) ois.readObject();
>          ois.close();
> 
> ...the structure of the original SOAP message is there, but none of the 
> content is recovered.
> 
> What am I doing wrong?
> 
> Regards,
> 
> Ric Searle
>