use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class AsyncHTTPConduitTest method testInovationWithHCAddress.
@Test
public void testInovationWithHCAddress() throws Exception {
String address = "hc://http://localhost:" + PORT + "/SoapContext/SoapPort";
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(Greeter.class);
factory.setAddress(address);
Greeter greeter = factory.create(Greeter.class);
String response = greeter.greetMe("test");
assertEquals("Get a wrong response", "Hello test", response);
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class DOMToStaxSamlTest method createClientProxy.
private Echo createClientProxy() {
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setServiceClass(Echo.class);
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
return (Echo) proxyFac.create();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class StaxToDOMRoundTripTest method createClientProxy.
private Echo createClientProxy() {
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setServiceClass(Echo.class);
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
return (Echo) proxyFac.create();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class StaxToDOMSignatureIdentifierTest method createClientProxy.
private Echo createClientProxy() {
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setServiceClass(Echo.class);
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
return (Echo) proxyFac.create();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class UserNameTokenAuthorizationTest method setUpService.
public void setUpService(String expectedRoles, boolean digest, boolean encryptUsernameTokenOnly) throws Exception {
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceBean(new EchoImpl());
factory.setAddress("local://Echo");
factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
Server server = factory.create();
Service service = server.getEndpoint().getService();
service.getInInterceptors().add(new SAAJInInterceptor());
service.getInInterceptors().add(new LoggingInInterceptor());
service.getOutInterceptors().add(new SAAJOutInterceptor());
service.getOutInterceptors().add(new LoggingOutInterceptor());
wsIn = new SimpleSubjectCreatingInterceptor();
wsIn.setSupportDigestPasswords(digest);
wsIn.setProperty(ConfigurationConstants.SIG_PROP_FILE, "insecurity.properties");
wsIn.setProperty(ConfigurationConstants.DEC_PROP_FILE, "insecurity.properties");
wsIn.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName());
service.getInInterceptors().add(wsIn);
SimpleAuthorizingInterceptor sai = new SimpleAuthorizingInterceptor();
sai.setMethodRolesMap(Collections.singletonMap("echo", expectedRoles));
service.getInInterceptors().add(sai);
wsOut = new WSS4JOutInterceptor();
wsOut.setProperty(ConfigurationConstants.SIG_PROP_FILE, "outsecurity.properties");
wsOut.setProperty(ConfigurationConstants.ENC_PROP_FILE, "outsecurity.properties");
wsOut.setProperty(ConfigurationConstants.USER, "myalias");
if (digest) {
wsOut.setProperty("password", "myAliasPassword");
} else {
wsOut.setProperty(ConfigurationConstants.PASSWORD_TYPE, WSS4JConstants.PW_TEXT);
}
if (encryptUsernameTokenOnly) {
wsOut.setProperty(ConfigurationConstants.ENCRYPTION_USER, "myalias");
wsOut.setProperty(ConfigurationConstants.ENCRYPTION_PARTS, "{Content}{" + WSS4JConstants.WSSE_NS + "}UsernameToken");
}
wsOut.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName());
service.getOutInterceptors().add(wsOut);
// Create the client
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setServiceClass(Echo.class);
proxyFac.setAddress("local://Echo");
proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID);
echo = (Echo) proxyFac.create();
((BindingProvider) echo).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
client = ClientProxy.getClient(echo);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getInInterceptors().add(wsIn);
client.getInInterceptors().add(new SAAJInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
client.getOutInterceptors().add(wsOut);
client.getOutInterceptors().add(new SAAJOutInterceptor());
}
Aggregations