You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Srinath Perera <he...@opensource.lk> on 2003/07/07 05:38:44 UTC

serialize / desirialize SOAPHeader

Hi everybody
How can I create, use, serialize and desirialize  SOAPHeader, SOAPEnvelope ect.   
my requirement is to use SOAPHeader ect on my own using SOAP implementation
classes.

I look at message, encoding packages in src. But the SOAP Header ect depend on 
serializingContext,DesializingContext which in turn depend on MessageContext
which is not avalible to me. (This is my custom application).

Do I have to rewrite serializingContext,DesializingContext on my own or any
easier way. 
anybody knows answer, referance ect.    

Thanks for your time
Srinath

AND here is a little prog I tried regarding the above, it is not working. Can 
any body see whats wrong.

public static void main(String[] args)throws Exception {
// create SOAPHeader from the response rq.xml(SOAP message)
  SOAPHeader h = new SOAPHeader("opensource.lk/axis/v2", "Transaction", "t", 
   null, new DeserializationContextImpl(
            new InputSource(
                        new FileInputStream(".//samples//rq.xml")),
            null,
            Constants.URI_SOAP12_RPC),
            SOAPConstants.SOAP11_CONSTANTS);
         System.out.println("h = " + h.getName());
         System.out.println("h = " + h.getValue());
         Writer w = new FileWriter(".//samples//rs.xml");
//write the header back to the res.xml
         h.output(new SerializationContextImpl(w ));
         w.flush();
         w.close();
//OR i try this as well to write
//ElementSerializer es = new ElementSerializer();
//es.serialize(h.getQName(),null,(Element)h.getChildElements().next(),
         new SerializationContextImpl(new FileWriter(".//samples//rs.xml")));
    }
---------------
Lanka Software Foundation  (http://www.opensource.lk)
Promoting Open-Source Development in Sri Lanka.
---------------

Re: serialize / desirialize SOAPHeader

Posted by Chris Haddad <ha...@apache.org>.
maybe looking at java/test/message/TestSOAPHeader.java will help?

/Chris


On Sun, 6 Jul 2003, Srinath Perera wrote:

> Hi everybody
> How can I create, use, serialize and desirialize  SOAPHeader, SOAPEnvelope ect.
> my requirement is to use SOAPHeader ect on my own using SOAP implementation
> classes.
>