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 pcallaway <pc...@hbs.edu> on 2007/12/17 20:25:43 UTC

org.apache.axis.encoding.AnyContentType

Hi folks,

I am new to using Axis to generate Java from WSDL and I have to say it is
pretty nice.  However, I had a question about getting data out of the
generated classes.

I used WSDL2Java to make the wrapper and stubs for the client, using the
WSDL attached.  Many of the "Response" classes don't have data in them
directly, but rather a MessageElement called _any.  This _any element seems
to just be the raw XML stuck in a hierarchy, and it seems very messy to get
at.

Is there any easy way to get at the elements and stick them into a class?  I
created a container class that is essentially a HashMap, but I'm not
entirely familiar with XML parsing, so I don't know if it is worth trying to
write code to fill that up, or if there is another way to get the data out
by field name (ie I need the result for Q2_3, do I have to search through
all the XML?).  It took me quite a while to figure out that MessageElement
was where my data was, I don't want to spend tons more time on this, because
it seems I've reached the end of the documentation.

I'm attaching a sample xml response and the original Response class that was
generated.  For some reason it created two classes for every Response, I
don't entirely understand that, either.  But the data is in the one I'm
including.

Thanks for the help...

Pam Callaway