I'm trying to see if I can use XMLBeans to deal with an Axiom SOAPBody.  The
following DeveloperWorks guide showed how to bring Axiom and XMLBeans
together:

http://www.ibm.com/developerworks/library/x-axiom/

So I tried to extend Sample 380 in WSO2-ESB and basically had this as the
first lines in my mediate() function:

XMLStreamReader reader =
mc.getEnvelope().getBody().getFirstElement().getFirstElement().getXMLStreamReaderWithoutCaching();
GetQuoteResponse resp = GetQuoteResponse.Factory.parse(reader);
System.out.println("Validate " + resp.validate());
System.out.println(resp.toString());

This is what prints out

Validate false
<ns:return type="samples.services.GetQuoteResponse" xmlns:ns="
http://services.samples/xsd";>
  <ns:change>-2.8637862443067323</ns:change>
  <ns:earnings>-8.734540628084734</ns:earnings>
  <ns:high>-87.61828398040504</ns:high>
  <ns:last>89.13763928944611</ns:last>
  <ns:lastTradeTimestamp>Sun Aug 03 13:33:52 EDT
2008</ns:lastTradeTimestamp>
  <ns:low>-88.94988407359973</ns:low>
  <ns:marketCap>4141070.6717920825</ns:marketCap>
  <ns:name>IBM Company</ns:name>
  <ns:open>-88.72550360449267</ns:open>
  <ns:peRatio>25.296622152954335</ns:peRatio>
  <ns:percentageChange>-2.9624706336045223</ns:percentageChange>
  <ns:prevClose>96.6688483531829</ns:prevClose>
  <ns:symbol>IBM</ns:symbol>
  <ns:volume>5034</ns:volume>
</ns:return>

I believe the problem is because the return element is defined as having a
type of samples.services.GetQuoteResponse.  How do I get XMLBeans to accept
the return element so that I can perform a function such as resp.getLast()?

Am I completely off base?  Is there a better way to do this?

Thanks,
Michael

Reply via email to