A developer wants to use WebServiceContext in the web service endpoint. Which of the following
is the correct way to get WebServiceContext object ? (Choose one)
A.
@WebService
public class MyService {
@WebServiceContext
WebServiceContext ctxt;
public String echo(String str) {
…
}
B.
@WebService
public class MyService {
WebServiceContext ctxt;
public String echo(String str) {
ctxt = jndi.lookup(“java:com/env/WebServiceContext”);
}
C.
@WebService
public class MyService {
@Inject
WebServiceContext ctxt;
public String echo(String str) {
…
}
D.
@WebService
public class MyService {
@Resource
WebServiceContext ctxt;
public String echo(String str) {
…
}
Explanation: