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 Tamas Hauer <ta...@cern.ch> on 2003/07/07 15:05:46 UTC

Access to serialization

Hi all,

I have a document/literal service successfully deployed[*].  The 
generation and deployment is done in the following way: first, there 
is a data schema in the form of an xsd that my methods have to comply 
with.  This is an external constraint on my service.  I "import" this 
into a wsdl where I define my methods which operate on types defined 
in the schema.  Then wsdl2java successfully generates all the java 
code I need an in general everything works ok.

My methods get the data in form of deserialized objects, which is what 
I need/want.  On the other hand I need to talk to some legacy code 
which expects this same data in the form of xml instances (conforming 
to the same xsd) (and serialized into strings).  What's the easiest 
way to serialize an already deserialized object to the xml (which is 
pretty identical to what was in the soap envelope)?  I notice that 
wsdl2java generates a getSerializer() method for every generated type. 
  How can I use this?  The best would be to transform the object into 
a DOM but a string (XML) would do as a last resort too.

Any clue would be greatly appreciated.

Tamas

[*] I need to express my continued thanks to the axis developers and 
those hanging out on this mailing list: the help I gotten here was 
invaluable already.

-- 
-------------------------------------------------------------------
--      Tamas Hauer          ETT Division, CERN
     Tamas.Hauer@cern.ch      Geneve 23 Switzerland 1211
  http://cern.ch/Tamas.Hauer  Tel:(41)-227672342  Fax:(41)-227678930


Re: Access to serialization

Posted by Srinath Perera <he...@opensource.lk>.
Hi Tamas,
Do not know weather this helps. To serialize the SOAPHeaderElement ect u can
use following output(SerializationContext)
   //create the header ignore 
   SOAPHeaderElement h = 
                new SOAPHeaderElement("www.opensource.lk/axis2", "user");
         h.setObjectValue("hemapani");
         
         h.setActor("lsf:authenticate");
         
         env.addHeader(h);

         //desirialize
         Writer w = new FileWriter("./samples/rs.xml");
         h.output(new SerializationContextImpl(w ));
hope this help.
regards

I am working with custom types(Actually I need it too). If I get Something I
will let you know.  
---------------
Lanka Software Foundation  (http://www.opensource.lk)
Promoting Open-Source Development in Sri Lanka.
---------------

---------- Original Message -----------
From: Tamas Hauer <ta...@cern.ch>
To: axis-user@ws.apache.org
Sent: Mon, 07 Jul 2003 15:05:46 +0200
Subject: Access to serialization

> Hi all,
> 
> I have a document/literal service successfully deployed[*].  The 
> generation and deployment is done in the following way: first, there 
> is a data schema in the form of an xsd that my methods have to 
> comply with.  This is an external constraint on my service.  I 
> "import" this into a wsdl where I define my methods which operate on 
> types defined in the schema.  Then wsdl2java successfully generates 
> all the java code I need an in general everything works ok.
> 
> My methods get the data in form of deserialized objects, which is 
> what I need/want.  On the other hand I need to talk to some legacy 
> code which expects this same data in the form of xml instances 
> (conforming to the same xsd) (and serialized into strings).  What's 
> the easiest way to serialize an already deserialized object to the 
> xml (which is pretty identical to what was in the soap envelope)?  I 
> notice that wsdl2java generates a getSerializer() method for every 
> generated type.   How can I use this?  The best would be to 
> transform the object into a DOM but a string (XML) would do as a 
> last resort too.
> 
> Any clue would be greatly appreciated.
> 
> Tamas
> 
> [*] I need to express my continued thanks to the axis developers and 
> those hanging out on this mailing list: the help I gotten here was 
> invaluable already.
> 
> -- 
> -------------------------------------------------------------------
> --      Tamas Hauer          ETT Division, CERN
>      Tamas.Hauer@cern.ch      Geneve 23 Switzerland 1211
>   http://cern.ch/Tamas.Hauer  Tel:(41)-227672342  Fax:(41)-227678930
------- End of Original Message -------