use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class JBWS2278TestCase method setup.
@Before
public void setup() throws Exception {
if (port11 == null) {
URL wsdlURL = new URL(baseURL + "/soap11?wsdl");
QName serviceName = new QName("http://org.jboss.test.ws/jbws2278", "TestService");
Service service = Service.create(wsdlURL, serviceName);
port11 = service.getPort(new QName("http://org.jboss.test.ws/jbws2278", "TestEndpointSoap11Port"), TestEndpoint.class);
port12 = service.getPort(new QName("http://org.jboss.test.ws/jbws2278", "TestEndpointSoap12Port"), TestEndpoint.class);
@SuppressWarnings("rawtypes") List<Handler> handlerChain11 = new ArrayList<Handler>();
handlerChain11.add(new TestHandler(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE, SOAPConstants.SOAP_1_1_CONTENT_TYPE));
((BindingProvider) port11).getBinding().setHandlerChain(handlerChain11);
@SuppressWarnings("rawtypes") List<Handler> handlerChain12 = new ArrayList<Handler>();
handlerChain12.add(new TestHandler(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, SOAPConstants.SOAP_1_2_CONTENT_TYPE));
((BindingProvider) port12).getBinding().setHandlerChain(handlerChain12);
}
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class MTOMFeatureTestCase method addMTOMCheckHandler.
private static void addMTOMCheckHandler(MTOMEndpoint port) {
SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
@SuppressWarnings("rawtypes") List<Handler> handlerChain = new ArrayList<Handler>();
handlerChain.addAll(binding.getHandlerChain());
handlerChain.add(new MTOMCheckClientHandler());
binding.setHandlerChain(handlerChain);
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class Helper method testConfigurationChange.
public boolean testConfigurationChange() throws Exception {
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
URL wsdlURL = new URL(address + "?wsdl");
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);
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
String resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
if (!"Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr)) {
return false;
}
configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Another Client Config");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class Helper method testConfigurationChangeOnDispatch.
public boolean testConfigurationChangeOnDispatch() throws Exception {
final String reqString = "<ns1:echo xmlns:ns1=\"http://clientConfig.jaxws.ws.test.jboss.org/\"><arg0>Kermit</arg0></ns1:echo>";
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
QName portName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointPort");
URL wsdlURL = new URL(address + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
Dispatch<Source> dispatch = service.createDispatch(portName, Source.class, Mode.PAYLOAD);
BindingProvider bp = (BindingProvider) dispatch;
@SuppressWarnings("rawtypes") List<Handler> hc = bp.getBinding().getHandlerChain();
hc.add(new UserHandler());
bp.getBinding().setHandlerChain(hc);
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Custom Client Config");
Source resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
String resStr = DOMUtils.getTextContent(DOMUtils.sourceToElement(resSource).getElementsByTagName("return").item(0));
if (!"Kermit|RoutOut|CustomOut|UserOut|LogOut|endpoint|LogIn|UserIn|CustomIn|RoutIn".equals(resStr)) {
return false;
}
configurer.setConfigHandlers(bp, "META-INF/jaxws-client-config.xml", "Another Client Config");
resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
resSource = dispatch.invoke(new DOMSource(DOMUtils.parse(reqString)));
resStr = DOMUtils.getTextContent(DOMUtils.sourceToElement(resSource).getElementsByTagName("return").item(0));
return ("Kermit|RoutOut|UserOut|endpoint|UserIn|RoutIn".equals(resStr));
}
use of javax.xml.ws.handler.Handler in project jbossws-cxf by jbossws.
the class Helper method testDefaultClientConfiguration.
/**
* This test hacks the current ServerConfig temporarily adding an handler from this testcase deployment
* into the AS default client configuration, verifies the handler is picked up and finally restores the
* original default client configuration.
*
* @return
* @throws Exception
*/
public boolean testDefaultClientConfiguration() throws Exception {
QName serviceName = new QName("http://clientConfig.jaxws.ws.test.jboss.org/", "EndpointImplService");
URL wsdlURL = new URL(address + "?wsdl");
final ClientConfig defaultClientConfig = TestUtils.getAndVerifyDefaultClientConfiguration();
// -- modify default conf --
try {
TestUtils.changeDefaultClientConfiguration();
// --
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);
String resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
resStr = port.echo("Kermit");
return ("Kermit|UserOut|LogOut|endpoint|LogIn|UserIn".equals(resStr));
} finally {
// -- restore default conf --
TestUtils.setClientConfigAndReload(defaultClientConfig);
// --
}
}
Aggregations