Author: dkulp Date: Tue Aug 14 17:14:03 2012 New Revision: 1372977 URL: http://svn.apache.org/viewvc?rev=1372977&view=rev Log: Merged revisions 1372975 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes
........ r1372975 | dkulp | 2012-08-14 13:13:16 -0400 (Tue, 14 Aug 2012) | 11 lines Merged revisions 1372972 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1372972 | dkulp | 2012-08-14 13:11:05 -0400 (Tue, 14 Aug 2012) | 3 lines Use the WS-A Action header to map to an operation if the SOAPAction was unable to. More attempts to match the desired action in the STSClient to an operation ........ ........ Modified: cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Modified: cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java?rev=1372977&r1=1372976&r2=1372977&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java (original) +++ cxf/branches/2.5.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapActionInInterceptor.java Tue Aug 14 17:14:03 2012 @@ -103,17 +103,20 @@ public class SoapActionInInterceptor ext String action = getSoapAction(message); if (!StringUtils.isEmpty(action)) { getAndSetOperation(message, action); + message.put(SoapBindingConstants.SOAP_ACTION, action); } } - private void getAndSetOperation(SoapMessage message, String action) { + public static void getAndSetOperation(SoapMessage message, String action) { if (StringUtils.isEmpty(action)) { return; } - message.put(SoapBindingConstants.SOAP_ACTION, action); Exchange ex = message.getExchange(); Endpoint ep = ex.get(Endpoint.class); + if (ep == null) { + return; + } BindingOperationInfo bindingOp = null; Modified: cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?rev=1372977&r1=1372976&r2=1372977&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Tue Aug 14 17:14:03 2012 @@ -45,6 +45,7 @@ import org.apache.cxf.binding.soap.SoapF import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.binding.soap.SoapVersion; import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.binding.soap.interceptor.SoapActionInInterceptor; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.common.util.StringUtils; import org.apache.cxf.headers.Header; @@ -116,7 +117,7 @@ public class MAPCodec extends AbstractSo * @param message the messsage */ public void handleMessage(SoapMessage message) { - mediate(message); + mediate(message); } /** @@ -159,9 +160,9 @@ public class MAPCodec extends AbstractSo } /** - * Mediate message flow, peforming MAP {en|de}coding. + * Mediate message flow, performing MAP {en|de}coding. * - * @param message the messsage message + * @param message the message message */ private void mediate(SoapMessage message) { if (!MessageUtils.getContextualBoolean(message, MAPAggregator.ADDRESSING_DISABLED, false)) { @@ -171,7 +172,19 @@ public class MAPCodec extends AbstractSo AddressingProperties maps = decode(message); ContextUtils.storeMAPs(maps, message, false); markPartialResponse(message, maps); - restoreExchange(message, maps); + restoreExchange(message, maps); + + if (maps != null + && !MessageUtils.isRequestor(message) + && message.getExchange().getBindingOperationInfo() == null + && !MessageUtils.isOutbound(message) + && maps.getAction() != null) { + //try and use the Action from the maps to find the operation + String action = maps.getAction().getValue(); + if (action != null) { + SoapActionInInterceptor.getAndSetOperation(message, action); + } + } } } } Modified: cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java?rev=1372977&r1=1372976&r2=1372977&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java (original) +++ cxf/branches/2.5.x-fixes/rt/ws/security/src/main/java/org/apache/cxf/ws/security/trust/STSClient.java Tue Aug 14 17:14:03 2012 @@ -580,6 +580,12 @@ public class STSClient implements Config //operation is not correct as the Action is not set correctly. Let's see if //we can at least find it by name and then set the action and such manually later. for (BindingOperationInfo boi : bi.getOperations()) { + if (suffix.endsWith(boi.getName().getLocalPart())) { + return boi; + } + } + //Still didn't find anything useful + for (BindingOperationInfo boi : bi.getOperations()) { if (boi.getInput().getMessageInfo().getMessageParts().size() > 0) { MessagePartInfo mpi = boi.getInput().getMessageInfo().getMessagePart(0); if ("RequestSecurityToken".equals(mpi.getConcreteName().getLocalPart())) {
