Search in sources :

Example 11 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class TwoWayJMSImplBase method greetMe.

public String greetMe(String me) {
    if (me.startsWith("PauseForTwoSecs")) {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
        // ignore
        }
        me = me.substring("PauseForTwoSecs".length()).trim();
    }
    MessageContext mc = wsContext.getMessageContext();
    JMSMessageHeadersType responseHeaders = (JMSMessageHeadersType) mc.get(JMSConstants.JMS_SERVER_RESPONSE_HEADERS);
    responseHeaders.putProperty("Test_Prop", "some return value " + me);
    return "Hello " + me;
}
Also used : JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) MessageContext(javax.xml.ws.handler.MessageContext)

Example 12 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SOAPJMSTestSuiteTest method test1009.

@Test
public void test1009() throws Exception {
    TestCaseType testcase = JMSTestUtil.getTestCase("test1009");
    final JMSSimplePortType simplePort = getPort("JMSSimpleService1009", "SimplePort", JMSSimpleService1009.class, JMSSimplePortType.class);
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    try {
        twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
    } catch (Exception e) {
        assertTrue(e.getMessage().contains("Unknow JMS Variant"));
    }
}
Also used : TestCaseType(org.apache.cxf.testsuite.testcase.TestCaseType) JMSSimplePortType(org.apache.cxf.jms_simple.JMSSimplePortType) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) JMSException(javax.jms.JMSException) WebServiceException(javax.xml.ws.WebServiceException) Test(org.junit.Test)

Example 13 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SOAPJMSTestSuiteTest method twoWayTestWithRequestHeader.

private void twoWayTestWithRequestHeader(TestCaseType testcase, final JMSSimplePortType port, JMSMessageHeadersType requestHeader) throws Exception {
    closeable = (java.io.Closeable) port;
    InvocationHandler handler = Proxy.getInvocationHandler(port);
    BindingProvider bp = (BindingProvider) handler;
    Map<String, Object> requestContext = bp.getRequestContext();
    if (requestHeader == null) {
        requestHeader = new JMSMessageHeadersType();
    }
    requestContext.put(JMSConstants.JMS_CLIENT_REQUEST_HEADERS, requestHeader);
    Exception e = null;
    try {
        String response = port.echo("test");
        assertEquals(response, "test");
    } catch (WebServiceException ew) {
        throw ew;
    } catch (Exception e1) {
        e = e1;
    }
    Map<String, Object> responseContext = bp.getResponseContext();
    JMSMessageHeadersType responseHeader = (JMSMessageHeadersType) responseContext.get(JMSConstants.JMS_CLIENT_RESPONSE_HEADERS);
    checkJMSProperties(testcase, requestHeader, responseHeader);
    if (e != null) {
        throw e;
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) BindingProvider(javax.xml.ws.BindingProvider) InvocationHandler(java.lang.reflect.InvocationHandler) JMSException(javax.jms.JMSException) WebServiceException(javax.xml.ws.WebServiceException)

Example 14 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SOAPJMSTestSuiteTest method test1001.

@Test
public void test1001() throws Exception {
    // same to test0002
    TestCaseType testcase = JMSTestUtil.getTestCase("test1001");
    final JMSSimplePortType simplePort = getPort("JMSSimpleService1001", "SimplePort", JMSSimpleService1001.class, JMSSimplePortType.class);
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    requestHeader.setSOAPJMSBindingVersion("0.3");
    try {
        twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
    } catch (Exception e) {
        assertTrue(e.getMessage().contains("Unrecognized BindingVersion"));
    }
}
Also used : TestCaseType(org.apache.cxf.testsuite.testcase.TestCaseType) JMSSimplePortType(org.apache.cxf.jms_simple.JMSSimplePortType) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) JMSException(javax.jms.JMSException) WebServiceException(javax.xml.ws.WebServiceException) Test(org.junit.Test)

Example 15 with JMSMessageHeadersType

use of org.apache.cxf.transport.jms.JMSMessageHeadersType in project cxf by apache.

the class SOAPJMSTestSuiteTest method test0002.

@Test
public void test0002() throws Exception {
    TestCaseType testcase = JMSTestUtil.getTestCase("test0002");
    final JMSSimplePortType simplePort = getPort("JMSSimpleService0001", "SimplePort", JMSSimpleService0001.class, JMSSimplePortType.class);
    JMSMessageHeadersType requestHeader = new JMSMessageHeadersType();
    requestHeader.setJMSCorrelationID("Correlator0002");
    twoWayTestWithRequestHeader(testcase, simplePort, requestHeader);
}
Also used : TestCaseType(org.apache.cxf.testsuite.testcase.TestCaseType) JMSSimplePortType(org.apache.cxf.jms_simple.JMSSimplePortType) JMSMessageHeadersType(org.apache.cxf.transport.jms.JMSMessageHeadersType) Test(org.junit.Test)

Aggregations

JMSMessageHeadersType (org.apache.cxf.transport.jms.JMSMessageHeadersType)20 Test (org.junit.Test)13 JMSSimplePortType (org.apache.cxf.jms_simple.JMSSimplePortType)8 TestCaseType (org.apache.cxf.testsuite.testcase.TestCaseType)8 JMSException (javax.jms.JMSException)7 BindingProvider (javax.xml.ws.BindingProvider)7 WebServiceException (javax.xml.ws.WebServiceException)7 URL (java.net.URL)6 QName (javax.xml.namespace.QName)6 Closeable (java.io.Closeable)3 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)3 HelloWorldOneWayPort (org.apache.cxf.hello_world_jms.HelloWorldOneWayPort)3 HelloWorldQueueDecoupledOneWaysService (org.apache.cxf.hello_world_jms.HelloWorldQueueDecoupledOneWaysService)3 InvocationHandler (java.lang.reflect.InvocationHandler)2 UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)2 ExecutionException (java.util.concurrent.ExecutionException)2 Endpoint (javax.xml.ws.Endpoint)2 MessageContext (javax.xml.ws.handler.MessageContext)2 JMSGreeterPortType (org.apache.cxf.jms_greeter.JMSGreeterPortType)2 JMSGreeterService (org.apache.cxf.jms_greeter.JMSGreeterService)2