javajava-ee-8

java - wsimport create handler-chain by bindingfile


I would like to automatically create the handler-chain using wsimport and a binding file. The annotation @HandlerChain is also created at the target class, but the reference to the XML as well as the XML itself is not created.

<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings version="3.0"
                xmlns="http://java.sun.com/xml/ns/jaxws" 
                xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
                xmlns:javaee="http://java.sun.com/xml/ns/javaee"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:jaxws="https://jakarta.ee/xml/ns/jaxws"
                jaxb:extensionBindingPrefixes="xjc"
                wsdlLocation="WSDL_QUERY_OUT.XML"
>

    <!-- Erstellen der Handler-Chain-Annotationen -->
    <jaxws:bindings node="wsdl:definitions">
        <javaee:handler-chains>
            <javaee:handler-chain>      
                <javaee:handler>
                    <javaee:handler-name>SoapEndpointHandler</javaee:handler-name>      
                    <javaee:handler-class>com.test.resources.SoapEndpointHandler</javaee:handler-class>                                            
                </javaee:handler> 
            </javaee:handler-chain>
        </javaee:handler-chains>
    </jaxws:bindings>
</jaxws:bindings>

What am I doing wrong?


Solution

  • I have found my mistake. In the bindings file I had entered a wrong namespace for javaee.

    wrong namespace: xmlns:javaee="http://java.sun.com/xml/ns/javaee"

    correct namespace: xmlns:javaee="https://jakarta.ee/xml/ns/jakartaee"

    corrected example

    <?xml version="1.0" encoding="UTF-8"?>
    <jaxws:bindings version="3.0"
                    xmlns="http://java.sun.com/xml/ns/jaxws" 
                    xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
                    xmlns:javaee="https://jakarta.ee/xml/ns/jakartaee"
                    xmlns:xs="http://www.w3.org/2001/XMLSchema"
                    xmlns:jaxws="https://jakarta.ee/xml/ns/jaxws"
                    jaxb:extensionBindingPrefixes="xjc"
                    wsdlLocation="WSDL_QUERY_OUT.XML"
    >
    
        <!-- Erstellen der Handler-Chain-Annotationen -->
        <jaxws:bindings node="wsdl:definitions">
            <javaee:handler-chains>
                <javaee:handler-chain>      
                    <javaee:handler>
                        <javaee:handler-name>SoapEndpointHandler</javaee:handler-name>      
                        <javaee:handler-class>com.test.resources.SoapEndpointHandler</javaee:handler-class>                                            
                    </javaee:handler> 
                </javaee:handler-chain>
            </javaee:handler-chains>
        </jaxws:bindings>
    </jaxws:bindings>