use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project steve by RWTH-i5-IDSG.
the class ApplicationTest method getForOcpp12.
private static ocpp.cs._2010._08.CentralSystemService getForOcpp12() {
JaxWsProxyFactoryBean f = getBean(path);
f.setServiceClass(ocpp.cs._2010._08.CentralSystemService.class);
return (ocpp.cs._2010._08.CentralSystemService) f.create();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project tomee by apache.
the class CalculatorTest method testCalculatorViaWsInterfaceFactoryBean.
public void testCalculatorViaWsInterfaceFactoryBean() throws Exception {
final JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(CalculatorWs.class);
factory.setAddress("http://localhost:" + port + "/webservice-ws-security/CalculatorImpl");
final CalculatorWs calc = (CalculatorWs) factory.create();
final Client client = ClientProxy.getClient(calc);
final Endpoint endpoint = client.getEndpoint();
endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
final Map<String, Object> outProps = new HashMap<>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "jane");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
@Override
public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
pc.setPassword("waterfall");
}
});
final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
endpoint.getOutInterceptors().add(wssOut);
assertEquals(10, calc.sum(4, 6));
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class Client method run.
public static void run(String[] args, final Bus bus) {
File wsdl = new File(args[0]);
final JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(AddNumbers.class);
factory.setWsdlURL(wsdl.toURI().toString());
final AddNumbers client = (AddNumbers) factory.create();
try {
int number1 = 10;
int number2 = 20;
System.out.printf("Invoking addNumbers(%d, %d)\n", number1, number2);
int result = client.addNumbers(number1, number2);
System.out.printf("The result of adding %d and %d is %d.\n\n", number1, number2, result);
number1 = 3;
number2 = 5;
System.out.printf("Invoking addNumbers(%d, %d)\n", number1, number2);
result = client.addNumbers(number1, number2);
System.out.printf("The result of adding %d and %d is %d.\n\n", number1, number2, result);
number1 = -10;
System.out.printf("Invoking addNumbers(%d, %d)\n", number1, number2);
result = client.addNumbers(number1, number2);
System.out.printf("The result of adding %d and %d is %d.\n", number1, number2, result);
} catch (AddNumbersFault ex) {
System.out.printf("Caught AddNumbersFault: %s\n", ex.getFaultInfo().getMessage());
}
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class ExceptionTest method testJaxwsNoXfireCompat.
@Test(expected = HelloException.class)
public void testJaxwsNoXfireCompat() throws Exception {
JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
sfbean.setServiceClass(ExceptionService.class);
sfbean.setDataBinding(new AegisDatabinding());
sfbean.getServiceFactory().setDataBinding(sfbean.getDataBinding());
sfbean.setAddress("local://ExceptionServiceJaxWs");
Server server = sfbean.create();
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://ExceptionServiceJaxWs");
proxyFac.setServiceClass(ExceptionService.class);
proxyFac.setBus(getBus());
proxyFac.getClientFactoryBean().getServiceFactory().setDataBinding(new AegisDatabinding());
ExceptionService clientInterface = (ExceptionService) proxyFac.create();
clientInterface.sayHiWithException();
}
use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project cxf by apache.
the class SOAPLoggingTest method createTestClient.
private TestService createTestClient(Feature feature) throws MalformedURLException {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress(SERVICE_URI);
factory.setFeatures(Collections.singletonList(feature));
return factory.create(TestService.class);
}
Aggregations