Java Code Examples for org.apache.axis2.client.ServiceClient#getLastOperationContext()
The following examples show how to use
org.apache.axis2.client.ServiceClient#getLastOperationContext() .
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: ESBJAVA2262ContentEncodingGzipTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.esb" }, description = "having 'Content-Encoding = gzip' within both in and out sequences and accepting gzip response") public void gzipCompressionBothInAndOutSequencesTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendAndReceiveGZIPCompressedPayload")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext .getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 2
Source File: ESBJAVA2262ContentEncodingGzipTestCase.java From micro-integrator with Apache License 2.0 | 5 votes |
@Test(groups = { "wso2.esb" }, description = "having 'Content-Encoding = gzip' within outsequence") public void gzipCompressionInsideOutSequenceTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendingGZIPCompressedPayloadToClient")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext .getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 3
Source File: ESBJAVA2262ContentEncodingGzipTestCase.java From micro-integrator with Apache License 2.0 | 5 votes |
@Test(groups = { "wso2.esb" }, description = "having 'Accept-Encoding = gzip' within both in and out sequences") public void sendingAndReceivingGzipCompressedPayloadTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendingGZIPCompressedPayloadToClient")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST, true); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext .getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 4
Source File: ESBJAVA2262ContentEncodingGzipTestCase.java From micro-integrator with Apache License 2.0 | 5 votes |
@Test(groups = { "wso2.esb" }, description = "sending and accepting gzip compressed payload") public void sendingAndReceivingGzipCompressedRequestInAllPathTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendAndReceiveGZIPCompressedPayload")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST, true); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext .getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 5
Source File: ESBJAVA2262ContentEncodingGzipTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = {"wso2.esb"}, description = "having 'Content-Encoding = gzip' within outsequence") public void gzipCompressionInsideOutSequenceTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendingGZIPCompressedPayloadToClient")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 6
Source File: ESBJAVA2262ContentEncodingGzipTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = {"wso2.esb"}, description = "having 'Content-Encoding = gzip' within both in and out sequences and accepting gzip response") public void gzipCompressionBothInAndOutSequencesTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendAndReceiveGZIPCompressedPayload")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 7
Source File: ESBJAVA2262ContentEncodingGzipTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = {"wso2.esb"}, description = "having 'Accept-Encoding = gzip' within both in and out sequences") public void sendingAndReceivingGzipCompressedPayloadTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendingGZIPCompressedPayloadToClient")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST, true); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 8
Source File: ESBJAVA2262ContentEncodingGzipTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = {"wso2.esb"}, description = "sending and accepting gzip compressed payload") public void sendingAndReceivingGzipCompressedRequestInAllPathTest() throws Exception { ServiceClient client = getServiceClient(getProxyServiceURLHttp("sendAndReceiveGZIPCompressedPayload")); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_GZIP_REQUEST, true); client.getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.MC_ACCEPT_GZIP, true); OMElement response = client.sendReceive(Utils.getStockQuoteRequest("GZIP")); OperationContext operationContext = client.getLastOperationContext(); MessageContext inMessageContext = operationContext.getMessageContext(WSDL2Constants.MESSAGE_LABEL_IN); CommonsTransportHeaders transportHeaders = (CommonsTransportHeaders) inMessageContext.getProperty(TRANSPORT_HEADERS); Assert.assertTrue(transportHeaders.containsKey(CONTENT_ENCODING), "Response Message not encoded"); Assert.assertEquals(transportHeaders.get(CONTENT_ENCODING), "gzip", "Response Message not gzip encoded"); Assert.assertTrue(response.toString().contains("GZIP")); Assert.assertTrue(response.toString().contains("GZIP Company")); }
Example 9
Source File: ProxyMessageReceiver.java From carbon-commons with Apache License 2.0 | 5 votes |
private SOAPEnvelope getResponseEnvelope(ServiceClient client) throws AxisFault { OperationContext operationContext = client.getLastOperationContext(); MessageContext messageContext = operationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE); if (messageContext != null) { return messageContext.getEnvelope(); } return null; }