This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JAX-WS with JAXB problem

 
Komandir Kozlov
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your answers . Problem was solved with use of annotations. Hope it would be helpful for someone.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic