Search in sources :

Example 11 with HelloWorldService

use of org.apache.cxf.hello_world_jms.HelloWorldService in project cxf by apache.

the class JMSClientServerTest method testBasicConnection.

@Test
public void testBasicConnection() throws Exception {
    QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService");
    QName portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort");
    URL wsdl = getWSDLURL("/wsdl/jms_test.wsdl");
    HelloWorldService service = new HelloWorldService(wsdl, serviceName);
    String response1 = new String("Hello Milestone-");
    String response2 = new String("Bonjour");
    HelloWorldPortType greeter = service.getPort(portName, HelloWorldPortType.class);
    for (int idx = 0; idx < 5; idx++) {
        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.testRpcLitFault("BadRecordLitFault");
            fail("Should have thrown BadRecoedLitFault");
        } catch (BadRecordLitFault ex) {
            assertNotNull(ex.getFaultInfo());
        }
        try {
            greeter.testRpcLitFault("NoSuchCodeLitFault");
            fail("Should have thrown NoSuchCodeLitFault exception");
        } catch (NoSuchCodeLitFault nslf) {
            assertNotNull(nslf.getFaultInfo());
            assertNotNull(nslf.getFaultInfo().getCode());
        }
    }
    ((java.io.Closeable) greeter).close();
}
Also used : BadRecordLitFault(org.apache.cxf.hello_world_jms.BadRecordLitFault) QName(javax.xml.namespace.QName) NoSuchCodeLitFault(org.apache.cxf.hello_world_jms.NoSuchCodeLitFault) HelloWorldService(org.apache.cxf.hello_world_jms.HelloWorldService) Closeable(java.io.Closeable) HelloWorldPortType(org.apache.cxf.hello_world_jms.HelloWorldPortType) URL(java.net.URL) Endpoint(javax.xml.ws.Endpoint) Test(org.junit.Test)

Example 12 with HelloWorldService

use of org.apache.cxf.hello_world_jms.HelloWorldService in project cxf by apache.

the class JMSSoapActionTest method testSayHi.

@Test
public void testSayHi() throws Exception {
    QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldServiceSoapAction");
    QName portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort");
    URL wsdl = getWSDLURL("/wsdl/jms_test.wsdl");
    HelloWorldService service = new HelloWorldService(wsdl, serviceName);
    String response = new String("Bonjour");
    HelloWorldPortType greeter = service.getPort(portName, HelloWorldPortType.class);
    ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingOutInterceptor());
    ClientProxy.getClient(greeter).getOutInterceptors().add(new LoggingInInterceptor());
    ((BindingProvider) greeter).getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
    ((BindingProvider) greeter).getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "SAY_HI_1");
    String reply = greeter.sayHi();
    assertNotNull("no response received from service", reply);
    assertEquals(response, reply);
    ((java.io.Closeable) greeter).close();
}
Also used : QName(javax.xml.namespace.QName) LoggingOutInterceptor(org.apache.cxf.ext.logging.LoggingOutInterceptor) HelloWorldService(org.apache.cxf.hello_world_jms.HelloWorldService) HelloWorldPortType(org.apache.cxf.hello_world_jms.HelloWorldPortType) LoggingInInterceptor(org.apache.cxf.ext.logging.LoggingInInterceptor) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)12 QName (javax.xml.namespace.QName)12 HelloWorldPortType (org.apache.cxf.hello_world_jms.HelloWorldPortType)12 HelloWorldService (org.apache.cxf.hello_world_jms.HelloWorldService)12 Test (org.junit.Test)12 HashMap (java.util.HashMap)5 Client (org.apache.cxf.endpoint.Client)5 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)5 ArrayList (java.util.ArrayList)4 AudienceRestrictionBean (org.apache.wss4j.common.saml.bean.AudienceRestrictionBean)4 ConditionsBean (org.apache.wss4j.common.saml.bean.ConditionsBean)4 Closeable (java.io.Closeable)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 LoggingInInterceptor (org.apache.cxf.ext.logging.LoggingInInterceptor)2 LoggingOutInterceptor (org.apache.cxf.ext.logging.LoggingOutInterceptor)2 AbstractVmJMSTest (org.apache.cxf.systest.jms.AbstractVmJMSTest)2 ExecutionException (java.util.concurrent.ExecutionException)1 AsyncHandler (javax.xml.ws.AsyncHandler)1 BindingProvider (javax.xml.ws.BindingProvider)1 Endpoint (javax.xml.ws.Endpoint)1