Sunday, January 27, 2013

When web service methods in implicit SEI are exposed

If you carefully watch/read @WebMethod annotation of JAX-WS API.

You can find that there is an attribute called "exclude" in @WebMethod annotation. Yes! as name suggests it controls whether the method of implicit SEI(Service Endpoint Interface) are exposed or not. 

One important thing is that - you can not use "exclude" attribute of @WebMethod annotation in explicit SEI(Service Endpoint Interface).

Also, there is some restriction of using "exclude" attribute of @WebMethod depending upon the JAX-WS version.

Prior to JAX-WS 2.1.6:
  • The method has an @WebMethod or @WebMethod(exclude=false) annotation and the containing class has an @WebService annotation.
  • The method has no @WebMethod annotation, but the containing class has a @WebWervice annotation and no other methods have @WebMethod or @WebMethod(exclude=false) annotation on it.
On JAX-WS 2.1.6 or Later:
  • The method has an @WebMethod or @WebMethod(exclude=false) annotation.
  • The method has no @WebMethod or @WebMethod(exclude=false) annotation but the containing class has an @WebService annotation.
Example:

public class Message {

    @WebMethod(exclude=false)
    public void send(String s) {...}

    public String accept() {...}
}

@WebService(targetNamespace="foo")
public class MessageImpl extends Message {

    @WebMethod(exclude=false)
    public void sendWrapper(String s) {...}

    public String acceptWrapper() {...}
}

Prior you JAX-WS 2.1.6
public void sendWrapper(String s) {...}

On or After JAX-WS 2.1.6

public void send(String s) {...}
public void sendWrapper(String s) {...}
public String acceptWrapper() {...}


No comments:

Post a Comment