use of org.jboss.ws.api.configuration.ClientConfigurer 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 org.jboss.ws.api.configuration.ClientConfigurer in project jbossws-cxf by jbossws.
the class Helper method testConfigurationChangeOnDispatch.
public boolean testConfigurationChangeOnDispatch() throws Exception {
Service service = Service.create(new URL(address + "?wsdl"), serviceName);
Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, Mode.MESSAGE);
org.apache.cxf.endpoint.Endpoint ep = ((DispatchImpl<SOAPMessage>) dispatch).getClient().getEndpoint();
assert (ep.get("propA") == null);
assert (ep.get("propB") == null);
ep.put("propZ", "valueZ");
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigProperties(dispatch, "META-INF/jaxws-client-config.xml", "Custom Client Config");
if (!ep.get("propA").equals("fileValueA") || !ep.get("propB").equals("fileValueB") || !ep.get("propZ").equals("valueZ")) {
return false;
}
configurer.setConfigProperties(dispatch, "META-INF/jaxws-client-config.xml", "Another Client Config");
return (ep.get("propA") == null && ep.get("propB") == null && ep.get("propC").equals("fileValueC") && ep.get("propZ").equals("valueZ"));
}
use of org.jboss.ws.api.configuration.ClientConfigurer in project jbossws-cxf by jbossws.
the class Helper method testGZIPUsingFeatureOnClient.
public boolean testGZIPUsingFeatureOnClient() throws Exception {
Bus bus = BusFactory.newInstance().createBus();
try {
BusFactory.setThreadDefaultBus(bus);
HelloWorld port = getPort();
ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
configurer.setConfigProperties(port, "jaxws-client-config.xml", "Feature Client Config");
return "foo".equals(port.echo("foo"));
} finally {
bus.shutdown(true);
}
}
Aggregations