Annotation Interface WebServiceRef


@Target({TYPE,METHOD,FIELD}) @Retention(RUNTIME) @Documented @Repeatable(WebServiceRefs.class) public @interface WebServiceRef
The WebServiceRef annotation is used to define a reference to a web service and (optionally) an injection target for it. It can be used to inject both service and proxy instances. These injected references are not thread safe. If the references are accessed by multiple threads, usual synchronization techinques can be used to support multiple threads.

Web service references are resources in the Jakarta EE sense. The annotations (for example, Addressing) annotated with meta-annotation WebServiceFeatureAnnotation can be used in conjunction with WebServiceRef. The created reference MUST be configured with annotation's web service feature.

For example, in the code below, the injected StockQuoteProvider proxy MUST have WS-Addressing enabled as specifed by the Addressing annotation.


    public class MyClient {
       @Addressing
       @WebServiceRef(StockQuoteService.class)
       private StockQuoteProvider stockQuoteProvider;
       ...
    }
 

If a Jakarta XML Web Services implementation encounters an unsupported or unrecognized annotation annotated with the WebServiceFeatureAnnotation that is specified with WebServiceRef, an ERROR MUST be given.

Since:
1.6, JAX-WS 2.0
See Also: