java - How to resolve collision in the ObjectFactory on wsdl2java? -


i'm using cxf , wsdl2java autogenerate webservice classes.

problem: somehow webservice want connect has duplicate names elements:

two declarations cause collision in objectfactory class

the xsd like:

<xs:schema targetnamespace="http://thenamespace">     <xs:complextype name="violatingname">      ...     </xs:complextype>     <xs:element name="violatingname" nillable="true" type="tns:violatingname"/> </xs:schema> 

the xsd imported inside wsdl used autogenerate jaxb classes this:

<wsdl:types>     <xsd:schema targetnamespace="http://imports">         <xsd:import schemalocation="https://path.to.xsd" namespace="http://thenamespace" /> 

i'm trying cover using jaxb-bindings.xml:

<jaxb:bindings         xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"     xmlns:xs="http://www.w3.org/2001/xmlschema"     xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"     jaxb:extensionbindingprefixes="xjc"        jaxb:version="2.1">      <jaxb:bindings schemalocation="https://path.to.xsd" node="//xs:schema">     <jaxb:bindings node=".//xs:element[@name='violatingname']">             <jaxb:property name="violatingnamebinding" />         </jaxb:bindings>     </jaxb:bindings> </jaxb:bindings> 

result:

[error] xpath evaluation of "//xs:schema" results in empty target node (org.apache.cxf:cxf-codegen-plugin:3.0.1:wsdl2java:generate-sources:generate-sources)

why node wrong here? xsd has xs:schema tag, why failing?

interesting fact: when use xpath tool, download xsd local machine check path, //xs:schema/xs:element[@name='violatingname'] evaluates proper tag.

it turned out have apply renaming/suffix on xs:complextype elements this:

<jaxb:bindings schemalocation="https://path.to.xsd" node="/xs:schema">     <jaxb:schemabindings>         <jaxb:namexmltransform>             <jaxb:typename suffix="type" />         </jaxb:namexmltransform>     </jaxb:schemabindings> </jaxb:bindings> 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -