Search in sources :

Example 96 with JaxWsProxyFactoryBean

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();
}
Also used : CentralSystemService(ocpp.cs._2012._06.CentralSystemService) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 97 with JaxWsProxyFactoryBean

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));
}
Also used : SAAJOutInterceptor(org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor) CallbackHandler(javax.security.auth.callback.CallbackHandler) HashMap(java.util.HashMap) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) IOException(java.io.IOException) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback) Callback(javax.security.auth.callback.Callback) Endpoint(org.apache.cxf.endpoint.Endpoint) UnsupportedCallbackException(javax.security.auth.callback.UnsupportedCallbackException) WSS4JOutInterceptor(org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor) Client(org.apache.cxf.endpoint.Client) WSPasswordCallback(org.apache.wss4j.common.ext.WSPasswordCallback)

Example 98 with JaxWsProxyFactoryBean

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());
    }
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) AddNumbers(org.apache.handlers.AddNumbers) File(java.io.File) AddNumbersFault(org.apache.handlers.AddNumbersFault)

Example 99 with JaxWsProxyFactoryBean

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();
}
Also used : Server(org.apache.cxf.endpoint.Server) BeanInvoker(org.apache.cxf.service.invoker.BeanInvoker) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Service(org.apache.cxf.service.Service) AegisDatabinding(org.apache.cxf.aegis.databinding.AegisDatabinding) JaxWsServerFactoryBean(org.apache.cxf.jaxws.JaxWsServerFactoryBean) Test(org.junit.Test) AbstractAegisTest(org.apache.cxf.aegis.AbstractAegisTest)

Example 100 with JaxWsProxyFactoryBean

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);
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Aggregations

JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)152 Test (org.junit.Test)71 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)21 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)19 AegisDatabinding (org.apache.cxf.aegis.databinding.AegisDatabinding)14 Greeter (org.apache.hello_world_soap_http.Greeter)14 Client (org.apache.cxf.endpoint.Client)13 HashMap (java.util.HashMap)10 JaxWsServerFactoryBean (org.apache.cxf.jaxws.JaxWsServerFactoryBean)9 QName (javax.xml.namespace.QName)8 WrappedGreeter (org.apache.hello_world_soap_action.WrappedGreeter)8 BookStoreService (org.apache.cxf.systest.jaxws.tracing.BookStoreService)7 ArrayList (java.util.ArrayList)6 ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)6 Holder (javax.xml.ws.Holder)5 Server (org.apache.cxf.endpoint.Server)5 Greeter (org.apache.cxf.greeter_control.Greeter)5 Service (org.apache.cxf.service.Service)5 HTTPConduit (org.apache.cxf.transport.http.HTTPConduit)5 Metadata (org.apache.cxf.ws.mex.model._2004_09.Metadata)5