diff options
author | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2010-06-18 11:09:58 +0000 |
---|---|---|
committer | edwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68> | 2010-06-18 11:09:58 +0000 |
commit | 7532f542e9820e4032ca3621e1600cb2dc1e5a7d (patch) | |
tree | c1be7121045259173ffe25048ed053d611db4737 /sca-java-2.x/trunk/modules/binding-ws-runtime-axis2 | |
parent | dc675dc249cbd523939792feecbc920fed10d939 (diff) |
Fix for subtask #2 of TUSCANY-3592 to enable the endpoint of a bidirectional web service to recognise the 2 special Web service Addressing values and throw the required SOAP fault
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@955932 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws-runtime-axis2')
-rw-r--r-- | sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java index 3defac736c..efc202b4d5 100644 --- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java +++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/TuscanyServiceProvider.java @@ -26,7 +26,9 @@ import javax.xml.namespace.QName; import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingFaultsHelper;
import org.apache.axis2.context.MessageContext;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Endpoint;
@@ -73,7 +75,24 @@ public class TuscanyServiceProvider { this.webServiceBindingFactory = (WebServiceBindingFactory)modelFactories.getFactory(WebServiceBindingFactory.class);
}
- public OMElement invoke(OMElement requestOM, MessageContext inMC) throws InvocationTargetException {
+ // Special WS_Addressing values
+ private static String WS_ADDR_ANONYMOUS = "http://www.w3.org/2005/08/addressing/anonymous";
+ private static String WS_ADDR_NONE = "http://www.w3.org/2005/08/addressing/none";
+ /**
+ * Check if the received callback address has either of the special WS-Addressing forms which are outlawed by the
+ * Web Service Binding specification [BWS50004]
+ * @param callbackAddress - the received callback address
+ * @param inMC - the Axis message context for the received forward call
+ * @throws AxisFault - throws a "OnlyNonAnonymousAddressSupportedFault" if the callback address has either of the special forms
+ */
+ private void checkCallbackAddress( String callbackAddress, MessageContext inMC ) throws AxisFault {
+ // If the address is anonymous or none, throw a SOAP fault...
+ if( WS_ADDR_ANONYMOUS.equals(callbackAddress) || WS_ADDR_NONE.equals(callbackAddress) ) {
+ AddressingFaultsHelper.triggerOnlyNonAnonymousAddressSupportedFault(inMC, "wsa:From");
+ }
+ } // end method checkCallbackAddress
+
+ public OMElement invoke(OMElement requestOM, MessageContext inMC) throws InvocationTargetException, AxisFault {
String callbackAddress = null;
String callbackID = null;
@@ -95,12 +114,16 @@ public class TuscanyServiceProvider { callbackAddress = callbackAddrElement.getText();
}
}
- }
+ } // end if
+ // Retrieve other callback-related headers
}
// Create a from EPR to hold the details of the callback endpoint
EndpointReference from = null;
if (callbackAddress != null ) {
+ // Check for special (& not allowed!) WS_Addressing values
+ checkCallbackAddress( callbackAddress, inMC );
+ //
from = assemblyFactory.createEndpointReference();
Endpoint fromEndpoint = assemblyFactory.createEndpoint();
from.setTargetEndpoint(fromEndpoint);
|