Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to convert one string to JAXBElement

 
Satchidananda Mohanty
Ranch Hand
Posts: 78
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I want to set one String to one method in webservices.
But the provider method is accepting JAXBElement.
But I do have the String Value foe that parameter.
So can anybody say how I could convert the string to JAXBElement ??

Please help.
Thanking you,

zeetu
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If you are developing a client that is to use JAXB, then the first step is to generate JAXB bean classes using XJC (the JAXB XML schema compiler).
With these classes in your project, you can then create a Source object from which the XML data of the request is read along these lines:

Best wishes!
 
Satchidananda Mohanty
Ranch Hand
Posts: 78
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ivan
 
Satchidananda Mohanty
Ranch Hand
Posts: 78
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I am totally new to this.So could not understand your point. Could you send some sample code so that I can utilize that.

I have used this codes.



and also tried with some other code.



Still I am not able to solve this.


Please help.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
When using JAXB, you start with an XML schema.
From this XML schema, you then generate a number of Java classes using XJC (http://java.sun.com/webservices/docs/2.0/jaxb/xjc.html).
Not until you have completed the above two steps can you start generating XML from instances of JAXB bean classes and/or convert XML to instances of JAXB bean classes.

Check out this JAXB tutorial: https://jaxb.dev.java.net/tutorial/
Make sure you understand what JAXB is and what it is supposed to help you with BEFORE you start writing programs of your own!
Best wishes!
 
Satchidananda Mohanty
Ranch Hand
Posts: 78
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,

Thanks a lot.

Yeah I will go through those tutorials.
In fact I solved those issues. My client has given the object factory class . So there are so many methods to convert these things.

Any way thanks a lot .

zeet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic