Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate @HandlerChain using wsimport

I'm generating Java from WSDL using wsimport (JAX-WS 2.1.3) and need to make it generate a @HandlerChain annotation. So I create a JAX-WS binding file:

<jaxws:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
wsdlLocation="../etc/MessageStudio.wsdl">

<jaxws:bindings node="wsdl:definitions">
    <javaee:handler-chain>
        <javaee:handler-chain-name>StrongmailHandlers</javaee:handler-chain-name>               
            <javaee:handler>
                <javaee:handler-name>OrganizationTokenHandler</javaee:handler-name>         
                <javaee:handler-class>com.bossmedia.strongmailadapter.deliveryadapter.OrganizationTokenHandler</javaee:handler-class>           
            </javaee:handler>                     
    </javaee:handler-chain>
</jaxws:bindings>

and run the wsimport Ant task:

 <wsimport 
        wsdl="../etc/MessageStudio.wsdl"
        sourcedestdir="../src/gen"
        destdir="../classes"
        verbose="false"
        binding="../etc/jaxws.bindings.xml">
 </wsimport>

but I get no annotation and no handler chain XML file. Googling only finds me solutions for changing packages, methods and arguments and the JAX-WS RI page from where I copied the XML.

Could you help me find the flaw in my configuration or another way, short of modifying the generated code, to get my handler into the chain?

like image 334
Mirvnillith Avatar asked Oct 28 '25 06:10

Mirvnillith


1 Answers

The answer is that the RI example is incorrect. There needs to be a handler-chains wrapper tag:

<jaxws:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
wsdlLocation="../etc/MessageStudio.wsdl">

<jaxws:bindings node="wsdl:definitions">
    <javaee:handler-chains>
        <javaee:handler-chain>
            <javaee:handler-chain-name>StrongmailHandlers</javaee:handler-chain-name>               
            <javaee:handler>
                <javaee:handler-name>OrganizationTokenHandler</javaee:handler-name>         
                <javaee:handler-class>com.bossmedia.strongmailadapter.deliveryadapter.OrganizationTokenHandler</javaee:handler-class>           
            </javaee:handler>                     
        </javaee:handler-chain>
    </javaee:handler-chains>
</jaxws:bindings>

like image 93
Mirvnillith Avatar answered Oct 29 '25 20:10

Mirvnillith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!