JAXB Customizations - Multiple schemas inside WSDL and schemaLocation
The JAXB Ri v2.1 added support for [Schema Component Designators][1], which in theory allow you to reference schema components symbolically, rather than by their file location and xpath location. In principle, this is much nicer to use, but I've never used it myself.
I'm not sure how widely supported this is, however. There's very little mention of it anywhere else other than that blog entry. It does mention it was part of the proposed spec for JAXB 2.1, so if that was passed, it should be implemented by every JAXB 2.1 implementation, including Java6. It's possible, though, that it was never actually added to the spec.
Had similar problem (five schemas in types with common names) and somehow didn't get SCD to work correctly. My solution was following:
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>