wood burning stoves 2.0*
The moose likes Web Services and the fly likes Using JAX-WS with JAXB problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Using JAX-WS with JAXB problem" Watch "Using JAX-WS with JAXB problem" New topic
Author

Using JAX-WS with JAXB problem

Komandir Kozlov
Greenhorn

Joined: Jun 04, 2008
Posts: 15
Hi,

How could I define namespace uri and prefix for nested elements in schema using JAXB?

I have next schema
...
<xs:element name="RequestXml">
<xs:complexType>
<xs:sequence>
<xs:element name="oInputXml">
<xs:complexType>
<xs:sequence>
<xs:element name="B2BAvailabilityRequest" >
...

and next code which deal with this JAXB generated beans

ObjectFactory factory = new ObjectFactory();
RequestXml requestXml = factory.createRequestXml();
RequestXml.OInputXml oInputXml = factory.createRequestXmlOInputXml();
RequestXml.OInputXml.B2BAvailabilityRequest req = factory.createRequestXmlOInputXmlB2BAvailabilityRequest();

// fill req here

oInputXml.setB2BAvailabilityRequest(req);
requestXml.setOInputXml(oInputXml);
JAXBElement<RequestXml> jRequest = factory.createRequestXml(requestXml);

Problem is that I could define namespase uri and prefix only for JAXBElement. But I need also to define prefix for oInputXml too. I could create JAXBElement from RequestXml.OInputXml

JAXBElement<RequestXml.OInputXml> oXml = factory.createRequestXmlOInputXml(oInputXml);

but then it can't be nested in JAXBElement<RequestXml>.

How could I define namespace prefix for xml element which would be generated from this bean? Should I do this in schema or there is programmatic methods?

Thanks in advance,
Komandir
Komandir Kozlov
Greenhorn

Joined: Jun 04, 2008
Posts: 15
Thanks for your answers . Problem was solved with use of annotations. Hope it would be helpful for someone.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using JAX-WS with JAXB problem