I tried to do what you suggested.  However, it does not seem to work.
It seems what ever I try, the custom bindings are ignored for files
generated from a schema external to the wsdl.  I don't seem to have
problems when using JAXB alone.  Am I doing something wrong?

 
<?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="conf/myschema.xsd"
node="/xsd:schema">
         <jaxb:schemaBindings>
             <jaxb:package name="com.mypackage"/>
         </jaxb:schemaBindings>
         <jaxb:globalBindings>
             <jaxb:serializable />
             <jaxb:javaType name="java.util.Calendar" xmlType="xsd:date"
 
printMethod="javax.xml.bind.DatatypeConverter.printDate"
 
parseMethod="javax.xml.bind.DatatypeConverter.parseDate">
             </jaxb:javaType>
             <jaxb:javaType name="java.util.Calendar"
xmlType="xsd:dateTime"
 
printMethod="javax.xml.bind.DatatypeConverter.printDateTime"
 
parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime">
             </jaxb:javaType>
         </jaxb:globalBindings>
     </jaxb:bindings>
</jaxws:bindings>


-----Original Message-----
From: Daniel Kulp [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 09, 2008 5:07 PM
To: [email protected]
Subject: Re: Custom Bindings With Schema Imported In WSDL


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