wsdl2java: Add Annotation to WebService Method or let WebService extend an interface

464 views Asked by At

We are currently working on a platform that uses SOAP with a WSDL interface. We take the top-down approach and generate java classes from the WSDL with JAX-WS.

What I would like to do is to add annotations to methods of the created WebService interface. If this is not possible, it would also be all right with me to let the generated WebService interface extend another interface, which then could be annotated.

As an example take the following wsdl:

<portType name="SoapDemo">
    <operation name="search">
        <input message="tns:search" wsam:Action="http://example.org/soapDemo/searchRequestType">
        </input>
        <output message="tns:searchResponseType" wsam:Action="http://example.org/soapDemo/searchResponseType">
        </output>
        <fault name="DemoException" message="tns:DemoException" wsam:Action="http://example.org/soapDemo/DemoException">
        </fault>
    </operation>
</portType>

I would now like to use custom binding that I get something like the following:

@WebService(name = "SoapDemo", targetNamespace = "http://example.org/soapDemo")
public interface ErnpSoap {

    @ImportantAnnotation
    @WebMethod
    @WebResult(targetNamespace = "")
    @RequestWrapper(localName = "search", targetNamespace = "http://example.org/soapDemo", className = "example.org.Search")
    @ResponseWrapper(localName = "searchResponseType", targetNamespace = "http://example.org/soapDemo", className = "example.org.SearchResponseType")
    public SearchResponse search(
        /* parameters go here */
        throws DemoException
    ;

Note the @ImportantAnnotation, which is what I want to add to the interface.

Is this possible at all?

0

There are 0 answers