Search in sources :

Example 11 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class JaxWSCamelTestSupport method getSampleWSAsyncWithCXFAPI.

public SampleWSAsync getSampleWSAsyncWithCXFAPI(String camelEndpoint) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress("camel://" + camelEndpoint);
    factory.setServiceClass(SampleWSAsync.class);
    factory.setBus(bus);
    return factory.create(SampleWSAsync.class);
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Example 12 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class CxfEndpointJMSConsumerTest method testInvocation.

@Test
public void testInvocation() {
    // Here we just the address with JMS URI
    String address = "jms:jndi:dynamicQueues/test.cxf.jmstransport.queue" + "?jndiInitialContextFactory" + "=org.apache.activemq.jndi.ActiveMQInitialContextFactory" + "&jndiConnectionFactoryName=ConnectionFactory&jndiURL=" + "vm://localhost";
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(Greeter.class);
    factory.setAddress(address);
    Greeter greeter = factory.create(Greeter.class);
    String response = greeter.greetMe("Willem");
    assertEquals("Get a wrong response", "Hello Willem", response);
}
Also used : Greeter(org.apache.hello_world_soap_http.Greeter) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Example 13 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class CxfHolderConsumerTest method testInvokingServiceWithSoapHeaderFromCXFClient.

@Test
public void testInvokingServiceWithSoapHeaderFromCXFClient() throws Exception {
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(ADDRESS);
    clientBean.setServiceClass(MyOrderEndpoint.class);
    MyOrderEndpoint client = (MyOrderEndpoint) proxyFactory.create();
    Holder<String> header = new Holder<String>();
    header.value = "parts";
    String result = client.mySecureOrder(1, header);
    assertEquals("Get a wrong order result", "Ordered ammount 1", result);
    assertEquals("Get a wrong parts", "secureParts", header.value);
}
Also used : ClientFactoryBean(org.apache.cxf.frontend.ClientFactoryBean) Holder(javax.xml.ws.Holder) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Example 14 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project camel by apache.

the class CxfHolderConsumerTest method testInvokingServiceFromCXFClient.

@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(ADDRESS);
    clientBean.setServiceClass(MyOrderEndpoint.class);
    MyOrderEndpoint client = (MyOrderEndpoint) proxyFactory.create();
    Holder<String> strPart = new Holder<String>();
    strPart.value = "parts";
    Holder<String> strCustomer = new Holder<String>();
    strCustomer.value = "";
    String result = client.myOrder(strPart, 2, strCustomer);
    assertEquals("Get a wrong order result", "Ordered ammount 2", result);
    assertEquals("Get a wrong parts", "parts", strPart.value);
    assertEquals("Get a wrong customer", "newCustomer", strCustomer.value);
}
Also used : ClientFactoryBean(org.apache.cxf.frontend.ClientFactoryBean) Holder(javax.xml.ws.Holder) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) Test(org.junit.Test)

Example 15 with JaxWsProxyFactoryBean

use of org.apache.cxf.jaxws.JaxWsProxyFactoryBean in project ddf by codice.

the class SecureProxyServiceFactoryImpl method createSecureClientFactory.

private <ProxyServiceType> ProxyServiceType createSecureClientFactory(WebServiceProperties<ProxyServiceType> wsp, SecurityToken token) throws UnsupportedOperationException {
    JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean();
    boolean populateFromClass = unavailableWsdls.contains(wsp.endpointWsdlURL);
    if (populateFromClass) {
        LOGGER.debug("Using service class to create client rather than WSDL.");
    }
    clientFactory.getClientFactoryBean().getServiceFactory().setPopulateFromClass(populateFromClass);
    LOGGER.debug("Configuring client proxy properties");
    configureProxyFactoryProperties(clientFactory, token, wsp);
    clientFactory.getOutInterceptors().add(new TokenPassThroughInterceptor());
    ProxyServiceType proxyServiceType;
    try {
        proxyServiceType = clientFactory.create(wsp.serviceClass);
    } catch (ServiceConstructionException e) {
        LOGGER.debug("Unable to use WSDL to build client. Attempting to use service class.", e);
        unavailableWsdls.add(wsp.endpointWsdlURL);
        clientFactory.getClientFactoryBean().getServiceFactory().setPopulateFromClass(true);
        proxyServiceType = clientFactory.create(wsp.serviceClass);
    }
    return proxyServiceType;
}
Also used : JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean) ServiceConstructionException(org.apache.cxf.service.factory.ServiceConstructionException)

Aggregations

JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)15 Test (org.junit.Test)7 ClientFactoryBean (org.apache.cxf.frontend.ClientFactoryBean)6 URL (java.net.URL)2 Holder (javax.xml.ws.Holder)2 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)2 Greeter (org.apache.hello_world_soap_http.Greeter)2 CreditAgencyWS (org.apache.camel.loanbroker.credit.CreditAgencyWS)1 Person (org.apache.camel.non_wrapper.Person)1 GetPerson (org.apache.camel.non_wrapper.types.GetPerson)1 GetPersonResponse (org.apache.camel.non_wrapper.types.GetPersonResponse)1 Greeter (org.apache.cxf.greeter_control.Greeter)1 PingMeFault (org.apache.cxf.greeter_control.PingMeFault)1 LoggingInInterceptor (org.apache.cxf.interceptor.LoggingInInterceptor)1 LoggingOutInterceptor (org.apache.cxf.interceptor.LoggingOutInterceptor)1 ServiceConstructionException (org.apache.cxf.service.factory.ServiceConstructionException)1