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 "Laat de, Harm, VF-NL" <Ha...@vodafone.com> on 2005/11/03 16:07:40 UTC

serialize axis object to xml

Hi all,

 

How can I see the XML representation of an instantiated Axis object?

 

I.e. I have a value object generated by the wsdl2java task.

 

When I instantiate this like:

 

MyType type = new MyType();

type.setName("test");

 

and do something like this:

 

type.toString()

 

I get: 

 

nl.test.cal.axis.MyTest@84fd786d

 

However, I would like to serialize to XML and see something like:

 

<test>

  <name>test</name>

</test>

 

Can you please help?

 

Regards,

 

Harm de Laat

 


Re: serialize axis object to xml

Posted by Davanum Srinivas <da...@gmail.com>.
Vishist,
ever looked at the test harness????? Lots of goodies there.

Harm de Laat,
see here for sample code
http://svn.apache.org/viewcvs.cgi/webservices/axis/trunk/java/test/encoding/

thanks,
dims

On 11/3/05, Vishist Mandapaka <vi...@gmail.com> wrote:
> You have multiple approaches to this.
>
> please refer to previous post by dims
> Folks,
>
> Here's the beginnings of the sample on how to mix xmlbeans and
> wsdl2java stuff :) Please submit patches to make it better. I will
> probably make a few more changes before i write it up. This email is
> just to give u all a heads up.
>
> http://svn.apache.org/viewcvs.cgi/webservices/axis/trunk/java/samples/xbeans/
>
> Also, Castor framework is one thing which you can opt for
> marshalling/unmarshalling. The only problem which I faced with Castor is
> that, the generated WSDL from Axis Service is not showing all the elements
> of the schema. We can get around it by specifying a hard-coded location of
> WSDL in server-config.wsdd.
>
> For integrating Castor with Axis, IBM folks wrote a nice paper. You might
> want to have a look at it
> http://www-128.ibm.com/developerworks/webservices/library/ws-castor/
> .
>
> Marshalling/Unmarshalling within Axis, I wish I could do it.
>
> thanks
> vishist.
>
>
>
> On 11/3/05, Laat de, Harm, VF-NL < Harm.deLaat@vodafone.com> wrote:
> >
> >
> >
> > Hi all,
> >
> >
> >
> > How can I see the XML representation of an instantiated Axis object?
> >
> >
> >
> > I.e. I have a value object generated by the wsdl2java task.
> >
> >
> >
> > When I instantiate this like:
> >
> >
> >
> > MyType type = new MyType();
> >
> > type.setName("test");
> >
> >
> >
> > and do something like this:
> >
> >
> >
> > type.toString()
> >
> >
> >
> > I get:
> >
> >
> >
> > nl.test.cal.axis.MyTest@84fd786d
> >
> >
> >
> > However, I would like to serialize to XML and see something like:
> >
> >
> >
> > <test>
> >
> >   <name>test</name>
> >
> > </test>
> >
> >
> >
> > Can you please help?
> >
> >
> >
> > Regards,
> >
> >
> >
> > Harm de Laat
> >
> >
>
>


--
Davanum Srinivas : http://wso2.com/blogs/

Re: serialize axis object to xml

Posted by Vishist Mandapaka <vi...@gmail.com>.
You have multiple approaches to this.

please refer to previous post by dims
Folks,

Here's the beginnings of the sample on how to mix xmlbeans and
wsdl2java stuff :) Please submit patches to make it better. I will
probably make a few more changes before i write it up. This email is
just to give u all a heads up.

http://svn.apache.org/viewcvs.cgi/webservices/axis/trunk/java/samples/xbeans/

Also, Castor framework is one thing which you can opt for
marshalling/unmarshalling. The only problem which I faced with Castor is
that, the generated WSDL from Axis Service is not showing all the elements
of the schema. We can get around it by specifying a hard-coded location of
WSDL in server-config.wsdd.

For integrating Castor with Axis, IBM folks wrote a nice paper. You might
want to have a look at it
http://www-128.ibm.com/developerworks/webservices/library/ws-castor/.

Marshalling/Unmarshalling within Axis, I wish I could do it.

thanks
vishist.


On 11/3/05, Laat de, Harm, VF-NL <Ha...@vodafone.com> wrote:
>
>  Hi all,
>
>  How can I see the XML representation of an instantiated Axis object?
>
>  I.e. I have a value object generated by the wsdl2java task.
>
>  When I instantiate this like:
>
>  MyType type = new MyType();
>
> type.setName("test");
>
>  and do something like this:
>
>  type.toString()
>
>  I get:
>
>  nl.test.cal.axis.MyTest@84fd786d
>
>  However, I would like to serialize to XML and see something like:
>
>  <test>
>
> <name>test</name>
>
> </test>
>
>  Can you please help?
>
>  Regards,
>
>  Harm de Laat
>
>