Search in sources :

Example 1 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSClientServerSoap12Test method testGzipEncodingWithJms.

@Test
public void testGzipEncodingWithJms() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService8");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort8");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService2 service = new SOAPService2(wsdl, serviceName);
    Greeter greeter = markForClose(service.getPort(portName, Greeter.class, cff));
    for (int idx = 0; idx < 5; idx++) {
        greeter.greetMeOneWay("test String");
        String greeting = greeter.greetMe("Milestone-" + idx);
        Assert.assertEquals(new String("Hello Milestone-") + idx, greeting);
        String reply = greeter.sayHi();
        Assert.assertEquals("Bonjour", reply);
        try {
            greeter.pingMe();
            Assert.fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            Assert.assertNotNull(ex.getFaultInfo());
        }
    }
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) QName(javax.xml.namespace.QName) Greeter(org.apache.hello_world_doc_lit.Greeter) SOAPService2(org.apache.hello_world_doc_lit.SOAPService2) URL(java.net.URL) Test(org.junit.Test)

Example 2 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSClientServerSoap12Test method testWSAddressingWithJms.

@Test
public void testWSAddressingWithJms() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService8");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort8");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService2 service = new SOAPService2(wsdl, serviceName);
    Greeter greeter = markForClose(service.getPort(portName, Greeter.class, cff, new AddressingFeature()));
    for (int idx = 0; idx < 5; idx++) {
        greeter.greetMeOneWay("test String");
        String greeting = greeter.greetMe("Milestone-" + idx);
        Assert.assertEquals(new String("Hello Milestone-") + idx, greeting);
        String reply = greeter.sayHi();
        Assert.assertEquals("Bonjour", reply);
        try {
            greeter.pingMe();
            Assert.fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            Assert.assertNotNull(ex.getFaultInfo());
        }
    }
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) AddressingFeature(javax.xml.ws.soap.AddressingFeature) QName(javax.xml.namespace.QName) Greeter(org.apache.hello_world_doc_lit.Greeter) SOAPService2(org.apache.hello_world_doc_lit.SOAPService2) URL(java.net.URL) Test(org.junit.Test)

Example 3 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class MultiTransportClientServerTest method testMultiTransportInOneService.

@Test
public void testMultiTransportInOneService() throws Exception {
    QName portName1 = new QName("http://apache.org/hello_world_doc_lit", "HttpPort");
    QName portName2 = new QName("http://apache.org/hello_world_doc_lit", "JMSPort");
    URL wsdl = getClass().getResource("/wsdl/hello_world_doc_lit.wsdl");
    Assert.assertNotNull(wsdl);
    MultiTransportService service = new MultiTransportService(wsdl, serviceName);
    String response1 = new String("Hello Milestone-");
    String response2 = new String("Bonjour");
    Greeter greeter = service.getPort(portName1, Greeter.class);
    TestUtil.updateAddressPort(greeter, PORT);
    for (int idx = 0; idx < 5; idx++) {
        String greeting = greeter.greetMe("Milestone-" + idx);
        Assert.assertNotNull("no response received from service", greeting);
        String exResponse = response1 + idx;
        Assert.assertEquals(exResponse, greeting);
        String reply = greeter.sayHi();
        Assert.assertNotNull("no response received from service", reply);
        Assert.assertEquals(response2, reply);
        try {
            greeter.pingMe();
            Assert.fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            Assert.assertNotNull(ex.getFaultInfo());
        }
    }
    ((java.io.Closeable) greeter).close();
    greeter = null;
    greeter = service.getPort(portName2, Greeter.class, cff);
    for (int idx = 0; idx < 5; idx++) {
        String greeting = greeter.greetMe("Milestone-" + idx);
        Assert.assertNotNull("no response received from service", greeting);
        String exResponse = response1 + idx;
        Assert.assertEquals(exResponse, greeting);
        String reply = greeter.sayHi();
        Assert.assertNotNull("no response received from service", reply);
        Assert.assertEquals(response2, reply);
        try {
            greeter.pingMe();
            Assert.fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            Assert.assertNotNull(ex.getFaultInfo());
        }
    }
    ((java.io.Closeable) greeter).close();
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) QName(javax.xml.namespace.QName) Greeter(org.apache.hello_world_doc_lit.Greeter) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) MultiTransportService(org.apache.hello_world_doc_lit.MultiTransportService) Test(org.junit.Test)

Example 4 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSTransactionTest method createGreeterProxy.

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

Example 5 with Greeter

use of org.apache.hello_world_doc_lit.Greeter in project cxf by apache.

the class JMSClientServerTest method testDocBasicConnection.

@Test
public void testDocBasicConnection() throws Exception {
    QName serviceName = new QName("http://apache.org/hello_world_doc_lit", "SOAPService2");
    QName portName = new QName("http://apache.org/hello_world_doc_lit", "SoapPort2");
    URL wsdl = getWSDLURL("/wsdl/hello_world_doc_lit.wsdl");
    SOAPService2 service = new SOAPService2(wsdl, serviceName);
    String response1 = new String("Hello Milestone-");
    String response2 = new String("Bonjour");
    Greeter greeter = service.getPort(portName, Greeter.class);
    Client client = ClientProxy.getClient(greeter);
    client.getEndpoint().getOutInterceptors().add(new TibcoSoapActionInterceptor());
    client.getOutInterceptors().add(new LoggingOutInterceptor());
    client.getInInterceptors().add(new LoggingInInterceptor());
    for (int idx = 0; idx < 5; idx++) {
        greeter.greetMeOneWay("test String");
        String greeting = greeter.greetMe("Milestone-" + idx);
        assertNotNull("no response received from service", greeting);
        String exResponse = response1 + idx;
        assertEquals(exResponse, greeting);
        String reply = greeter.sayHi();
        assertNotNull("no response received from service", reply);
        assertEquals(response2, reply);
        try {
            greeter.pingMe();
            fail("Should have thrown FaultException");
        } catch (PingMeFault ex) {
            assertNotNull(ex.getFaultInfo());
        }
    }
    ((java.io.Closeable) greeter).close();
}
Also used : PingMeFault(org.apache.hello_world_doc_lit.PingMeFault) QName(javax.xml.namespace.QName) Closeable(java.io.Closeable) SOAPService2(org.apache.hello_world_doc_lit.SOAPService2) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) Greeter(org.apache.hello_world_doc_lit.Greeter) TibcoSoapActionInterceptor(org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) Client(org.apache.cxf.endpoint.Client) Test(org.junit.Test)

Aggregations

Greeter (org.apache.hello_world_doc_lit.Greeter)10 Test (org.junit.Test)9 URL (java.net.URL)7 QName (javax.xml.namespace.QName)7 PingMeFault (org.apache.hello_world_doc_lit.PingMeFault)5 SOAPService2 (org.apache.hello_world_doc_lit.SOAPService2)5 Closeable (java.io.Closeable)3 Endpoint (javax.xml.ws.Endpoint)3 TibcoSoapActionInterceptor (org.apache.cxf.binding.soap.interceptor.TibcoSoapActionInterceptor)2 Client (org.apache.cxf.endpoint.Client)2 AbstractVmJMSTest (org.apache.cxf.systest.jms.AbstractVmJMSTest)2 Connection (javax.jms.Connection)1 JMSException (javax.jms.JMSException)1 Queue (javax.jms.Queue)1 XAException (javax.transaction.xa.XAException)1 AddressingFeature (javax.xml.ws.soap.AddressingFeature)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)1 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)1 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1