use of jakarta.xml.ws.handler.PortInfo in project metro-jax-ws by eclipse-ee4j.
the class HandlerClient method testDynamic2.
/*
* Test tries to add a handler programmatically after clearing
* handlers out of the service. Adds handler using HandlerResolver.
* Uses a null HandlerResolver to clear the service.
*/
public void testDynamic2() throws Exception {
Hello_Service service = createService();
service.setHandlerResolver(null);
Hello stub = createStub(service);
int x = 1;
// 2 per handler invoked
int diff = 2;
int y = stub.hello(x);
assertEquals(x + diff, y);
// now add client handler
service.setHandlerResolver(new HandlerResolver() {
public List<Handler> getHandlerChain(PortInfo info) {
List list = new ArrayList<Handler>();
list.add(new SOAPTestHandler());
return list;
}
});
stub = createStub(service);
// test again
diff = 4;
y = stub.hello(x);
assertTrue(y == x + diff);
}
use of jakarta.xml.ws.handler.PortInfo in project metro-jax-ws by eclipse-ee4j.
the class HandlerChainTester method testPortInfoImpl.
/*
Commenting this test as this no longer is useful.
In 2.1, When we try to add a invalid Port to a service with wsdl, now we throw WebServiceException,
during addPort() itself saying Port name is not a valid port in the wsdl.
public void testHandlersOnUnknownPortDispatch(){
TestService_Service service = getService();
String bindingId = SOAPBinding.SOAP11HTTP_BINDING;
service.addPort(UNKNOWNPORT, bindingId, endpointAddress);
Dispatch<Source> dispatch = service.createDispatch(UNKNOWNPORT, Source.class,Service.Mode.PAYLOAD);
Binding testBinding = ((BindingProvider) dispatch).getBinding();
List<Handler> chain = testBinding.getHandlerChain();
//System.out.println(chain.size());
assertEquals(2,chain.size());
}
*/
public void testPortInfoImpl() {
PortInfo portInfo = new PortInfoImpl(BindingID.SOAP11_HTTP, new QName("http://example.com/", "EchoPort"), new QName("http://example.com/", "EchoService"));
assertTrue(portInfo.equals(portInfo));
}
Aggregations