In your bindings file, you have have multiple <jaxb:bindings> elements that have different schema locations.

In your case, you could have:


<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema"
         xmlns:jaxws="http://java.sun.com/xml/ns/jaxws";
         xmlns:jaxb="http://java.sun.com/xml/ns/jaxb";
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
         xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

<jaxb:bindings schemaLocation="http://url/to/wsdl1"; node="/ xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="org.apache.cxf.wsdl1"/>
        </jaxb:schemaBindings>
        <jaxb:globalBindings >
           <jaxb:serializable/>
        </jaxb:globalBindings
    </jaxb:bindings>
<jaxb:bindings schemaLocation="http://url/to/wsdl2"; node="/ xs:schema">
        <jaxb:schemaBindings>
            <jaxb:package name="org.apache.cxf.wsdl2"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>
</jaxws:bindings>

etc.....


You could also have each "binding" in a separate file with a unigue schemaLocation and node and such and then use the -b flag multiple times.



Dan



On Jul 9, 2008, at 11:20 AM, Urciolo, Kevin wrote:

I have a custom binding file as shown below:

<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema"
         xmlns:jaxws="http://java.sun.com/xml/ns/jaxws";
         xmlns:jaxb="http://java.sun.com/xml/ns/jaxb";
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
         xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
    <jaxb:globalBindings>
       <jaxb:serializable/>
    </jaxb:globalBindings>
</jaxws:bindings>

I call wsdl to java using the following:

<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true"
failonerror="true" errorproperty="stderror.out">
           <arg value="-all" />
           <arg value="-b" />
           <arg value="conf/custom-binding.xml" />
           <arg value="-d" />
           <arg value="gen-src" />
           <arg value="-verbose" />
           <arg value="wsdl/mywsdl.wsdl" />
           <classpath>
               <path refid="cxf.classpath" />
           </classpath>
       </java>


It seems the custom binding is working for WSDLs where the schema is
located inside the WSDL.  However, the custom bindings seem to be
ignored when the WSDL imports the schema.  The custom binding file is
processed since errors appear if the xml is not well formed, they are
not applied to the generated files.

Any ideas what I need to do to get the cutom bindings applied to source
generated from an imported schema?

Thanks.

---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to