use of jakarta.xml.ws.Binding in project metro-jax-ws by eclipse-ee4j.
the class WSServletDelegate method doPut.
/**
* Handles HTTP PUT for XML/HTTP binding based endpoints
* @param request the HTTP request object
* @param response the HTTP response object
* @param context the Servlet context object
* @throws ServletException for errors
*/
public void doPut(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws ServletException {
// TODO: unify this into doGet.
try {
ServletAdapter target = getTarget(request);
if (target != null) {
if (logger.isLoggable(Level.FINEST)) {
logger.finest(WsservletMessages.SERVLET_TRACE_GOT_REQUEST_FOR_ENDPOINT(target.name));
}
} else {
Localizer localizer = getLocalizerFor(request);
writeNotFoundErrorPage(localizer, response, "Invalid request");
return;
}
Binding binding = target.getEndpoint().getBinding();
if (binding instanceof HTTPBinding) {
target.handle(context, request, response);
} else {
response.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
}
} catch (JAXWSExceptionBase e) {
logger.log(Level.SEVERE, defaultLocalizer.localize(e), e);
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (Throwable e) {
if (e instanceof Localizable) {
logger.log(Level.SEVERE, defaultLocalizer.localize((Localizable) e), e);
} else {
logger.log(Level.SEVERE, "caught throwable", e);
}
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
}
use of jakarta.xml.ws.Binding in project metro-jax-ws by eclipse-ee4j.
the class HandlerClient method testLogicalSource.
/*
* Test removes the static handler and adds a logical
* handler that uses a Source to change the message.
*/
public void testLogicalSource() throws Exception {
Hello stub = createStub();
Binding binding = ((BindingProvider) stub).getBinding();
LogicalTestHandler handler = new LogicalTestHandler();
handler.setHandleMode(LogicalTestHandler.HandleMode.SOURCE);
List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.add(handler);
binding.setHandlerChain(handlerChain);
int x = 1;
// 2 per handler invoked
int diff = 4;
int y = stub.hello(x);
// x+4 with all handlers
assertEquals(x + diff, y);
}
use of jakarta.xml.ws.Binding in project metro-jax-ws by eclipse-ee4j.
the class HandlerClient method testSOAP12Binding1.
/*
* The normal tests in this file are for soap 1.1. This is a soap 1.2
* test to make sure that the port is created with the proper binding
* so that the proper handlers are called. See bug 6353179.
*
* Not working right now -- can't get endpoint to work.
*/
public void testSOAP12Binding1() throws Exception {
Hello_Service service = createService();
Hello12 stub = create12Stub(service);
// make sure port is working
int x = 1;
// server handler only
int diff = 2;
int y = stub.hello12(x);
assertEquals(x + diff, y);
Binding binding = ((BindingProvider) stub).getBinding();
List<Handler> handlers = binding.getHandlerChain();
assertEquals("should be 1 handler in chain", 1, handlers.size());
Handler handler = handlers.get(0);
assertTrue("handler should be type Port12Handler, not " + handler.getClass().toString(), handler instanceof Port12Handler);
Port12Handler p12h = (Port12Handler) handler;
p12h.resetCalled();
stub.hello12(2);
assertEquals("handler should have been called two times", 2, p12h.getCalled());
}
use of jakarta.xml.ws.Binding in project metro-jax-ws by eclipse-ee4j.
the class HandlerChainTester method testHandlersOnTestPort.
public void testHandlersOnTestPort() {
TestService_Service service = getService();
TestService testStub = service.getTestServicePort();
Binding testBinding = ((BindingProvider) testStub).getBinding();
List<Handler> chain = testBinding.getHandlerChain();
// System.out.println(chain.size());
assertEquals(3, chain.size());
}
use of jakarta.xml.ws.Binding in project metro-jax-ws by eclipse-ee4j.
the class HandlerChainTester method testHandlersOnReportPort1.
public void testHandlersOnReportPort1() {
Service service = Service.create(WSDL_LOCATION, TESTSERVICE);
ReportService testStub = service.getPort(ReportService.class);
Binding testBinding = ((BindingProvider) testStub).getBinding();
List<Handler> chain = testBinding.getHandlerChain();
// System.out.println(chain.size());
assertEquals(0, chain.size());
}
Aggregations