Java Code Examples for org.apache.cxf.jaxws.JaxWsProxyFactoryBean#setTransportId()

The following examples show how to use org.apache.cxf.jaxws.JaxWsProxyFactoryBean#setTransportId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JMSTransactionTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Greeter createGreeterProxy() throws Exception {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setBus(bus);
    factory.getFeatures().add(cff);
    factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
    factory.setServiceClass(Greeter.class);
    factory.setAddress(SERVICE_ADDRESS);
    return (Greeter)markForClose(factory.create());
}
 
Example 2
Source File: ClientServerSwaTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testSwa() throws Exception {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setWsdlLocation("classpath:/swa-mime_jms.wsdl");
    factory.setTransportId(SoapJMSConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
    factory.setServiceName(new QName("http://cxf.apache.org/swa", "SwAService"));
    factory.setEndpointName(new QName("http://cxf.apache.org/swa", "SwAServiceJMSPort"));
    factory.setAddress(ADDRESS + broker.getEncodedBrokerURL());
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    SwAService port = factory.create(SwAService.class);


    Holder<String> textHolder = new Holder<>();
    Holder<DataHandler> data = new Holder<>();

    ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
    DataHandler handler = new DataHandler(source);

    data.value = handler;

    textHolder.value = "Hi";

    port.echoData(textHolder, data);
    InputStream bis = null;
    bis = data.value.getDataSource().getInputStream();
    byte[] b = new byte[10];
    bis.read(b, 0, 10);
    String string = IOUtils.newStringFromBytes(b);
    assertEquals("testfoobar", string);
    assertEquals("Hi", textHolder.value);

    if (port instanceof Closeable) {
        ((Closeable)port).close();
    }
}
 
Example 3
Source File: JavaFirstNoWsdlTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void specNoWsdlService(String messageType) throws Exception {
    String address = SERVICE_ADDRESS + ((messageType != null) ? "&messageType=" + messageType : "");
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setBus(bus);
    factory.getFeatures().add(cff);
    factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
    factory.setServiceClass(Hello.class);
    factory.setAddress(address);
    Hello client = (Hello)markForClose(factory.create());
    String reply = client.sayHi(" HI");
    Assert.assertEquals("get HI", reply);
}
 
Example 4
Source File: AsyncHTTPConduitTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvocationWithTransportId() throws Exception {
    String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(Greeter.class);
    factory.setAddress(address);
    factory.setTransportId("http://cxf.apache.org/transports/http/http-client");
    Greeter greeter = factory.create(Greeter.class);
    String response = greeter.greetMe("test");
    assertEquals("Get a wrong response", "Hello test", response);
}
 
Example 5
Source File: NettyClientTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvocationWithTransportId() throws Exception {
    String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(Greeter.class);
    factory.setAddress(address);
    factory.setTransportId("http://cxf.apache.org/transports/http/netty/client");
    Greeter greeter = factory.create(Greeter.class);
    String response = greeter.greetMe("test");
    assertEquals("Get a wrong response", "Hello test", response);
}
 
Example 6
Source File: NettyHttpConduitTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testInvocationWithTransportId() throws Exception {
    String address = "http://localhost:" + PORT + "/SoapContext/SoapPort";
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(Greeter.class);
    factory.setAddress(address);
    factory.setTransportId("http://cxf.apache.org/transports/http/netty/client");
    Greeter greeter = factory.create(Greeter.class);
    String response = greeter.greetMe("test");
    assertEquals("Get a wrong response", "Hello test", response);
}
 
Example 7
Source File: ClientJMS.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static HelloWorld createClientCxf() {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID);
    factory.setAddress(JMS_ENDPOINT_URI);
    return factory.create(HelloWorld.class);
}