JAXB setup - multiple schemas inside WSDL and schemaLocation

I have a WSDL that contains 3 schemas inside the "types" element. Schemas are not defined in external XSD, but inside the types element.

I want to configure an element inside the circuit number 2 and change its name to avoid conflict.

So in schemaLocation, how can I do this? Despite the question, I have a way to do this:

schemaLocation="../wsdl-files/mywsdl.wsdl#types?schema2"> ... <jxb:bindings node="some xpath 

but I'm not the one who found him, but my colleague who no longer works with me. Is there a resource where I can find an explanation, even if I understand it? Link or book? Somewhere where I can find other examples.

My problem is the value of schemaLocation (../wsdl-files/mywsll.wsdl # types? Schema2), not the xpath. I want to know all the possibilities of referencing a schema inside WSDL. I need documentation for this or something else.

Many thanks

+7
wsdl jaxb
source share
3 answers

JAXB Ri v2.1 adds support for [Designation of circuit components] [1], which theoretically allows you to symbolically refer to circuit components, rather than the location of their files and the location of xpath. In principle, it is much nicer to use, but I never used it myself.

I am not sure how widely supported this is. There is very little mention of this elsewhere than this blog entry. He mentions that it was part of the proposed specification for JAXB 2.1, so if accepted, it should be implemented in every implementation of JAXB 2.1, including Java6. It is possible, however, that it was never added to the specification.

+3
source share

It had a similar problem (five schemes in types with common names) and for some reason did not get SCD for proper operation. My solution is as follows:

custombinding.xml:

 <jxb:bindings version="2.1" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <jxb:bindings schemaLocation="file:wsdlfile.wsdl" node="*/xs:schema[1]"> <jxb:schemaBindings> <jxb:package name="my.custom.package"/> </jxb:schemaBindings> </jxb:bindings> </jxb:bindings> 

xjc call in ant build file:

 <target name="xjc_generate"> <exec executable="xjc" > <arg value="-wsdl" /> <arg value="${wsdl.base}/service/wsdlfile.wsdl" /> <arg value="-d" /> <arg value="${dir.src}" /> <arg value="-b" /> <arg value="${wsdl.base}/service/custombinding.xjb" /> </exec> </target> 
+1
source share

You need to specify the location of the circuit in wsdl as follows - if this is the second circuit.

eg: mywsdl.wsdl # types2
If the 10th then mywsdl.wsdl # types10

Hope this helps someone.

  <jxb:bindings version="2.1" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <jxb:bindings schemaLocation="../wsdl-files/mywsdl.wsdl#types2" node="/xs:schema"> <jxb:schemaBindings> <jxb:package name="my.custom.package"/> </jxb:schemaBindings> </jxb:bindings> </jxb:bindings> 
0
source share

All Articles