0

With using of JAX-WS, implemented @WebMethod method in @WebService class. Need to do something like this:

WebService.java:

@WebMethod
@MyWrapper
public Object someWebserviceMethod() ...

Here is MyWrapper annotation, which must wrap call of someWebserviceMethod into another code, where it will be decided whether to execute it or not. For example, in such way:

MyWrapperImpl.java:

...
public Object wrapMethodExecution( contextOfCalledWebMethod ) {
    if ( someFlag ) {
        //then contextOfCalledWebMethod called to execute someWebserviceMethod
        //or directly call Method.invoke()
    } else {
        return null; //or error message
    }

So wrapMethodExecution() needs to be automatically called before the call to any method, annotated with @MyWrapper.

Is it possible to perform such pattern by using jax-ws?

I tried to use WebServiceFeatureAnnotation but failed.

4
  • possible duplicate of What are JAX-WS Interceptors (also known as handlers)?
    – kolossus
    Aug 3, 2015 at 16:41
  • think - not, cause WebService.java already has shown architecture, and it seems that using of interceptor will cause to redesign it. so i need the solution, where only changes in WebService.java are - to add @MyWrapper anotation where neccessary
    – daemon
    Aug 4, 2015 at 10:49
  • There's no magic annotation for that - your options are: a handler, or a CDI interceptor
    – kolossus
    Aug 4, 2015 at 18:12
  • I'm not looking for magic))). I hoped, that there are standard instruments in JAX-WS, that give abilities to extend it's functionality by custom annotations (thought - WebServiceFeatureAnnotation was such one). But i failed to find them.
    – daemon
    Aug 5, 2015 at 10:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.