Friday, June 3, 2016

The most effective method to Get MessageContext In Service Implementation Class In JAX-WS

MessageContext is utilized to get all sort of information connected with current SOAP ask. In JAX-WS, this how you can get MessageContext in your administration execution class:



@WebService
public class TestingService {
    @Resource
    WebServiceContext wsc;

    @WebMethod
    public String sayHi(String name) {
        MessageContext mc = wsc.getMessageContext();
    }
}

On the off chance that you are speculation who set the WebServiceContext in our class, its runtime. Prior to the SOAP strategy is called. The runtime infuse the WebServiceContext distinguishing by @Resource comment. Furthermore, from this WebServiceContext, we get MessageContext.


No comments:

Post a Comment