2 Replies Latest reply on Jan 10, 2008 11:25 AM by Brad Marshall

    Is this a valid JAX-WS binding file for wsconsume?

    Brad Marshall Newbie

      I want wsconsume to do custom package to namespace mappings using the --binding option. I have no experience writing JAX-WS binding files. I created the one listed below, and while wsconsume generates no errors, it also ignores the the pacjage-namespace attributes in the file. What have I got wrong?

      (Note that these same parameters, restructured for Axis and with escaping the colons, work with the Axis Wsdl2Java tool as a NsToPkg.properties file.)

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       wsdlLocation="CA.wsdl"
       xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
       <jaxws:package-namespace package="ca.webservice.valueobj.cse" namespace="urn:lm:tscse"/>
       <jaxws:package-namespace package="ca.webservice.request" namespace="urn:lm:tsqikreq"/>
       <jaxws:package-namespace package="ca.webservice.response" namespace="urn:lm:tsqikrsp"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.ca" namespace="urn:anyco:tsca"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.ca" namespace="urn:anyco:tscsact"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.ci" namespace="urn:anyco:tsci"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.ci" namespace="urn:anyco:tscis"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.cp" namespace="urn:anyco:tscp"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.cp" namespace="urn:anyco:tscspt"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.fn" namespace="urn:anyco:tsfn"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.fn" namespace="urn:anyco:tsfin"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.id" namespace="urn:anyco:tsidy"/>
       <jaxws:package-namespace package="ca.webservice.valueobj.header" namespace="urn:anyco:tschdr"/>
       <jaxws:package-namespace package="ca.webservice.caws" namespace="http://www.anyco.com/wsdl/CA.wsdl"/>
       <jaxws:package-namespace package="ca.webservice.caws" namespace="http://www.anyco.com/wsdl/CA.xsd"/>
      </jaxws:bindings>
      
      


        • 1. Re: Is this a valid JAX-WS binding file for wsconsume?
          Brad Marshall Newbie

          I am now getting quite specific. Our WSDL defines four operations and imports 13 schemas. I have solved all of my namespace-to-package mapping issues for our schema files with a JAXB binding file which looks like this:

          <jxb:bindings version="1.0"
           xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
           xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           wsdlLocation="CARetriever.wsdl">
           <jxb:bindings schemaLocation="xyz.xsd" node="/xs:schema">
           <jxb:schemaBindings>
           <jxb:package name="com.ca.webservice.valueobj.xyz"/>
           </jxb:schemaBindings>
           </jxb:bindings>
          <!--and for 12 other schemas as well -->
          </jxb:bindings>


          And I've solved the wsdl:definitions node namespace to mapping issues with a JAX-WS binding file that looks like this:

          <jaxws:bindings version="2.0"
           xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
           wsdlLocation="CARetriever.wsdl">
           <jaxws:bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
           node="wsdl:definitions">
           <jaxws:package name="com.ca.webservice.caservice"/>
           </jaxws:bindings>
          </jaxws:bindings>

          However, my binding element for the WSDL's wsdl:definitions/wsdl:types/xsd:schema node shown below doesn't work - wsconsume produces the message 'Null', then fails to parse the wsdl and subsequently fails to launch WsImport.

          <jaxws:bindings version="2.0"
           <jaxws:bindings
           node="wsdl:definitions/wsdl:types/xsd:schema">
           <jxb:schemaBindings>
           <jxb:package name="com.ca.webservice.caservice"/>
           </jxb:schemaBindings>
           </jaxws:bindings>
          </jaxws:bindings>


          I've found many examples of this syntax for this last binding, and I can't see any error. I've also done it with the node attribute written in the (sanitized) form:

          node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://www.ourdomain.com/our/namespace']">


          Alas, with no joy. Can anyone help me understand why this last binding attribute isn't working with wsconsume?


          • 2. Re: Is this a valid JAX-WS binding file for wsconsume?
            Brad Marshall Newbie

            A slight correction in what I have actually usef for the last binding:

            <jxb:bindings version="1.0"
             xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
             xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
             xmlns:xs="http://www.w3.org/2001/XMLSchema"
             wsdlLocation="CARetriever.wsdl">
             <jaxws:bindings
             node="wsdl:definitions/wsdl:types/xsd:schema">
             <jxb:schemaBindings>
             <jxb:package name="com.ca.webservice.caservice"/>
             </jxb:schemaBindings>
             </jaxws:bindings>
            </jaxws:bindings>