use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class Helper method testCustomClientConfiguration.
/**
* This test hacks the current ServerConfig temporarily adding a test client configuration, uses that
* for the test client and finally removes it from the ServerConfig.
*
* @return
* @throws Exception
*/
public boolean testCustomClientConfiguration() throws Exception {
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
URL wsdlURL = new URL(address + "?wsdl");
final String testConfigName = "MyTestConfig";
try {
// -- add test client configuration
TestUtils.addTestCaseClientConfiguration(testConfigName);
// --
Service service = Service.create(wsdlURL, serviceName);
Endpoint port = (Endpoint) service.getPort(Endpoint.class);
BindingProvider bp = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> hc = bp.getBinding().getHandlerChain();
hc.add(new UserHandler());
bp.getBinding().setHandlerChain(hc);
ClientConfigUtil.setConfigHandlers(bp, null, testConfigName);
String resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
} finally {
// -- remove test client configuration --
TestUtils.removeTestCaseClientConfiguration(testConfigName);
// --
}
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class JBWS1283TestCase method testAttachmentResponse.
@Test
@RunAsClient
public void testAttachmentResponse() throws Exception {
QName serviceName = new QName("http://org.jboss.test.ws/jbws1283", "JBWS1283Service");
URL wsdlURL = new URL(baseURL + "/jaxws-jbws1283/JBWS1283Service/JBWS1283EndpointImpl?wsdl");
Service service = Service.create(wsdlURL, serviceName);
JBWS1283Endpoint port = service.getPort(JBWS1283Endpoint.class);
// Add a client-side handler that verifes existence of the attachment
BindingProvider bindingProvider = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.add(new VerifyAttachmentHandler());
bindingProvider.getBinding().setHandlerChain(handlerChain);
port.requestAttachmentData();
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class JBWS2419TestCase method testSOAP11ClientAccess.
@Test
@RunAsClient
public void testSOAP11ClientAccess() throws Exception {
URL wsdlURL = new URL(baseURL + "/soap11?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP11EndpointBeanService");
Service service = Service.create(wsdlURL, qname);
SOAP11Endpoint port = service.getPort(SOAP11Endpoint.class);
BindingProvider provider = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.addAll(provider.getBinding().getHandlerChain());
handlerChain.add(new SOAP11ClientHandler());
provider.getBinding().setHandlerChain(handlerChain);
((SOAPBinding) provider.getBinding()).setMTOMEnabled(true);
DataHandler response = port.namespace(new DataHandler("Jimbo", "text/plain"));
Object messg = getContent(response);
assertEquals("Hello Jimbo", messg);
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class JBWS2419TestCase method testSOAP12ClientAccess.
@Test
@RunAsClient
public void testSOAP12ClientAccess() throws Exception {
URL wsdlURL = new URL(baseURL + "/soap12?wsdl");
QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP12EndpointBeanService");
Service service = Service.create(wsdlURL, qname);
SOAP12Endpoint port = service.getPort(SOAP12Endpoint.class);
BindingProvider provider = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.addAll(provider.getBinding().getHandlerChain());
handlerChain.add(new SOAP12ClientHandler());
provider.getBinding().setHandlerChain(handlerChain);
((SOAPBinding) provider.getBinding()).setMTOMEnabled(true);
DataHandler response = port.namespace(new DataHandler("Jimbo", "text/plain"));
Object messg = getContent(response);
assertEquals("Hello Jimbo", messg);
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class HandlerChainTestCase method testDynamicHandlerChain.
@Test
@RunAsClient
public void testDynamicHandlerChain() throws Exception {
QName serviceName = new QName(targetNS, "EndpointImplService");
URL wsdlURL = new URL(baseURL + "/TestService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Endpoint port = service.getPort(Endpoint.class);
BindingProvider bindingProvider = (BindingProvider) port;
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.add(new LogHandler());
handlerChain.add(new AuthorizationHandler());
handlerChain.add(new RoutingHandler());
handlerChain.add(new ClientMimeHandler());
bindingProvider.getBinding().setHandlerChain(handlerChain);
String resStr = port.echo("Kermit");
assertEquals("Kermit|LogOut|AuthOut|RoutOut|RoutIn|AuthIn|LogIn|endpoint|LogOut|AuthOut|RoutOut|RoutIn|AuthIn|LogIn", resStr);
assertCookies();
}
Aggregations