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 Antonio Casqueiro <ac...@yahoo.co.uk> on 2005/04/07 18:28:11 UTC

AXIS object to XML String

Hello!

I think this is a easy question, but I canĀ“t seam to find the answer...

After building sucessfully my WebServices, I can up with the following 
problem:
I wish to write the XML that represents the state of object to a file, 
so I would like to call a method like "toXmlString()"


Example:

=> Simple Object Class
MyObject (generated by AXIS)
    private String myField1;
    private String myField2;

=> Application Code
MyObject o = new MyObject();
o.setField1("1");
o.setField2("2");

// How can I do this?
String xml = o.toXmlString();


=> Desired value
<root>
    <myField1>1</myField1>
    <myField2>2</myField2>
</root>


Thanks in advance
---
Antonio Casqueiro