aspose file tools*
The moose likes Web Services and the fly likes how to convert one string to JAXBElement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "how to convert one string to JAXBElement" Watch "how to convert one string to JAXBElement" New topic
Author

how to convert one string to JAXBElement

Satchidananda Mohanty
Ranch Hand

Joined: Mar 12, 2008
Posts: 77

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


Zeet

SCJP 6.0
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
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

Joined: Mar 12, 2008
Posts: 77

Thanks Ivan
Satchidananda Mohanty
Ranch Hand

Joined: Mar 12, 2008
Posts: 77

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

Joined: Oct 04, 2006
Posts: 2198
    
    1
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

Joined: Mar 12, 2008
Posts: 77

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to convert one string to JAXBElement
 
Similar Threads
JAXB namespace
Printing element name using JAXB 2.0
JAXB Problem
REST Web Service: 415 - Unsupported Media Type error
Newbie JAXBElement Constructor question (using Collections)