Which of the following is NOT a correct way of configuring handlers on a Web Service client ? (Choose one)
A.
Specify the handlers in jaxws-catalog.xml and make it available in the classpath of the client
B.
Create a handlerchain as list of handlers and call setHandlerChain() with that list on the Binding object.
C.
Programmatically configure the handlers by setting a custom HandlerResolver on the service instance and create proxies from that service.
D.
Specify handlers in handler chain configuration XML file and add @HandlerChain referencing handler configuration file to the Web Service references for clients running in JavaEE Container.
Hi
B) is valid configuration for handlers on a web service client
public static void main(String[ ] args) {
Endpoint endpoint = Endpoint.create(new Echo());
Binding binding = endpoint.getBinding();
List hchain = new LinkedList();
hchain.add(new EchoSecurityHandler());
binding.setHandlerChain(hchain);
endpoint.publish(“http://localhost:7777/echo”);
}
C)is valid configuration for handlers on a web service client
class FibClientHR {
public static void main(String[ ] args) {
RabbitCounterService service = new RabbitCounterService();
service.setHandlerResolver(new ClientHandlerResolver());
RabbitCounter port = service.getRabbitCounterPort();
try {
int n = 27;
System.out.printf(“fib(%d) = %d\n”, n, port.countRabbits(n));
}
catch(Exception e) { System.err.println(e); }
}
}
class ClientHandlerResolver implements HandlerResolver {
public List getHandlerChain(PortInfo port_info) {
List hchain = new ArrayList();
hchain.add(new UUIDHandler());
hchain.add(new TestHandler()); // for illustration only
}
}
D)is valid configuration for handlers on a web service client
@@HandlerChain(file = “handler-chain.xml”)
public class RabbitCounter {
file “handler-chain.xml”
fibC.TestHandler
fibC.UUIDHandler
fibC.ArgHandler
A)Not is valid configuration for handlers on a web service client
An XML catalog enables your application to reference imported XML resources,
such as WSDLs and XSDs, from a source that is different from that which is part of the description of the Web Service.
Redirecting the XML resources in this way may be required to improve performance or to ensure your application runs properly in your local environment.
For example, a WSDL may be accessible during client generation, but may no longer be accessible when the client is run.
You may need to reference a resource that is local to or bundled with your application rather than a resource that is available over the network.
Using an XML catalog file, you can specify the location of the WSDL that will be used by the Web Service at runtime.
Correct is A