• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issue in parsing xs:choice using cxf maven wsdl2java plugin and jaxb binding

 
Pritha Das
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
I am facing issue in parsing xs:choice in a wsdl with external xsd containing structure as given below using cxf maven plugin 2.7.11 , java6 , jaxxws2.1 and Jaxb2.2.6.
I have used jaxb bing file to parse xs:choice but the elements in the Object are of type JAXBElement instead of proper Object type.How to resolve this issue?
Please help ,its urgent.
XSD:
<xs:element name="Response">
<xs:annotation>
<xs:documentation>retrieve Response </xs:documentation>
<xs:documentation />
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="com1:Test" />
<xs:choice>
<xs:element ref="com1:cId" />
<xs:element ref="com1:CustInternalId" />
<xs:element ref="ContactId" />
<xs:element ref="com1:CustId" />
</xs:choice>
<xs:element ref="com1:RefDetl" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>

Generated code

@XmlElementRefs({
@XmlElementRef(name = "CId", namespace = "http://schemas.com/common/4_1", type = JAXBElement.class),
@XmlElementRef(name = "ContactId", namespace = "http://schemas.com/ip/4_0", type = JAXBElement.class),
@XmlElementRef(name = "CustInternalId", namespace = "http://schemas.com/ip/common/4_1", type = JAXBElement.class),
@XmlElementRef(name = "CustId", namespace = "http://schemas.com/ip/common/4_1", type = JAXBElement.class)
})
protected Object cIdOrCustInternalIdOrContactId;


Binding file:
<jxb:bindings version="2.1" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="schema.xsd"node="/xs:schema">
<jxb:bindings
node="//xs:element[@name='Response']//xs:complexType//xs:sequence//xs:choice">
<jaxb:globalBindings fixedAttributeAsConstantProperty="true" choiceContentProperty="true">
</jxb:bindings>
</jxb:bindings>
 
ramzi dridi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you find here a complete example of jaxb

http://j2eeandroid.blogspot.com/2014/12/tutorial-jaxb-2.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!