Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse Process Manager (Stardust) » Unmarshalling nested or complex data elements in JAVA Web services(Unmarshalling nested or complex data elements in JAVA Web services)
Unmarshalling nested or complex data elements in JAVA Web services [message #1709233] Fri, 25 September 2015 07:13 Go to next message
Koko Yumbe is currently offline Koko YumbeFriend
Messages: 2
Registered: September 2015
Junior Member
We are developing JAVA web services and have come up with input to the web services. The input has data elements and the last element is an Arraylist which has four items. We are able to get the values of first set of elements which are not in arraylist and then save or store them in a database. The challenge we have is to get the values of nested elements in arraylist .

We are using the following code but it is complaining or giving error message that it cannot see (DataInfo.xml) XML file.

 JAXBContext jaxbContext = JAXBContext.newInstance(DataInfo.class);
       Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();          
    DataInfo  EXitems = (DataInfo) jaxbUnmarshaller.unmarshal(new File("DataInfo.xml") );


How can we ensure that DataInfo.xml is generated at the runtime?
Re: Unmarshalling nested or complex data elements in JAVA Web services [message #1709382 is a reply to message #1709233] Mon, 28 September 2015 07:15 Go to previous messageGo to next message
Ashish Khole is currently offline Ashish KholeFriend
Messages: 28
Registered: April 2015
Junior Member
Hi,

To pass XML content, you need to wrap the content in a Reader, and unmarshal that instead:

Try the following if this helps:

JAXBContext jaxbContext = JAXBContext.newInstance(DataInfo.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

StringReader reader = new StringReader("xml string here");
DataInfo EXitems  = (DataInfo) unmarshaller.unmarshal(reader);


-Cheers
Ashish
Re: Unmarshalling nested or complex data elements in JAVA Web services [message #1709418 is a reply to message #1709382] Mon, 28 September 2015 10:49 Go to previous message
Koko Yumbe is currently offline Koko YumbeFriend
Messages: 2
Registered: September 2015
Junior Member
Hi Ashish Khole,
Thanks for the response, but the challenge I have is generating the XML at the run time or dynamically. When I use static XML with the values it is working. So the main problem is on how to DataInfo.xml file at run time or dynamically
Previous Topic:[File missing] Camel Route to Send and Receive Email
Next Topic:Error while setting up Stardust 3.0.1 with MySQL 5.6
Goto Forum:
  


Current Time: Fri Sep 21 21:06:51 GMT 2018

Powered by FUDForum. Page generated in 0.01323 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top