You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ni...@apache.org on 2012/10/22 11:35:03 UTC
svn commit: r1400813 - in /cxf/branches/2.6.x-fixes: ./
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/
systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/
Author: ningjiang
Date: Mon Oct 22 09:35:02 2012
New Revision: 1400813
URL: http://svn.apache.org/viewvc?rev=1400813&view=rev
Log:
Merged revisions 1400798 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1400798 | ningjiang | 2012-10-22 16:42:26 +0800 (Mon, 22 Oct 2012) | 1 line
CXF-4583 Fixed the Empty soap response issue When the logical handler return false processing the outbound message.
........
Modified:
cxf/branches/2.6.x-fixes/ (props changed)
cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java
Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Merged /cxf/trunk:r1400798
Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java?rev=1400813&r1=1400812&r2=1400813&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java (original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java Mon Oct 22 09:35:02 2012
@@ -171,12 +171,13 @@ public class LogicalHandlerOutIntercepto
LogicalHandlerInInterceptor.class.getName());
observer.onMessage(responseMsg);
}
+ return;
}
} else {
// server side - abort
- //System.out.println("Logical handler server side aborting");
+ // Even return false, also should try to set the XMLStreamWriter using
+ // reader or domWriter, or the SOAPMessage's body maybe empty.
}
- return;
}
if (origMessage != null) {
message.setContent(SOAPMessage.class, origMessage);
@@ -195,8 +196,6 @@ public class LogicalHandlerOutIntercepto
throw new Fault(e);
}
}
-
}
-
}
Modified: cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=1400813&r1=1400812&r2=1400813&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Mon Oct 22 09:35:02 2012
@@ -431,6 +431,21 @@ public class HandlerInvocationTest exten
}
@Test
+ public void testLogicHandlerHandleMessageReturnFalseServerOutbound() throws PingException {
+ String[] expectedHandlers = {"server handler1 outbound stop", "soapHandler4",
+ "soapHandler3", "handler2", "handler1", "handler1"};
+
+ List<String> resp = handlerTest.pingWithArgs("server handler1 outbound stop");
+
+ assertEquals(expectedHandlers.length, resp.size());
+
+ int i = 0;
+ for (String expected : expectedHandlers) {
+ assertEquals(expected, resp.get(i++));
+ }
+ }
+
+ @Test
public void testSOAPHandlerHandleMessageReturnsFalseServerInbound() throws PingException {
String[] expectedHandlers = {"soapHandler4", "soapHandler3", "soapHandler4"};
List<String> resp = handlerTest.pingWithArgs("soapHandler3 inbound stop");
Modified: cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java?rev=1400813&r1=1400812&r2=1400813&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java (original)
+++ cxf/branches/2.6.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/TestHandler.java Mon Oct 22 09:35:02 2012
@@ -168,12 +168,33 @@ public class TestHandler<T extends Logic
return ret;
}
- private boolean handlePingMessage(boolean outbound, T ctx) {
+ private boolean checkServerOutBindStopHandler(boolean outbound, T ctx) {
+ if (outbound) {
+ LogicalMessage msg = ctx.getMessage();
+ Object obj = msg.getPayload(jaxbCtx);
+ if (obj instanceof PingResponse) {
+ // only check if we need call for the server response handler false
+ PingResponse origResp = (PingResponse)obj;
+ for (String handler : origResp.getHandlersInfo()) {
+ if (handler.indexOf("server") == 0 && handler.indexOf(getHandlerId()) > 0
+ && handler.indexOf("stop") > 0) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+ private boolean handlePingMessage(boolean outbound, T ctx) {
LogicalMessage msg = ctx.getMessage();
addHandlerId(msg, ctx, outbound);
- return getHandleMessageRet();
- }
+ if (checkServerOutBindStopHandler(outbound, ctx)) {
+ return false;
+ } else {
+ return getHandleMessageRet();
+ }
+ }
private void addHandlerId(LogicalMessage msg, T ctx, boolean outbound) {