summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2010-06-19 06:41:04 +0000
committeredwardsmj <edwardsmj@13f79535-47bb-0310-9956-ffa450edef68>2010-06-19 06:41:04 +0000
commite3c894b83f5b02aa019f5dd709e3f7d6e3fdfc9d (patch)
treebe03445f177f7deb781befe024e060dc0ea23b08
parentc8ac9d68bc34566fc6f03dcfe25da1b500e2ab54 (diff)
Handle the wsa:ReferenceParameters SOAP header if present on the invocation of a bidirectional service offered as a Web service - pass the parameters back in the SOAP headers of any callback operation invocation from the service to the client, as required by TUSCANY-3592
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@956193 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java18
-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.java33
2 files changed, 39 insertions, 12 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/Axis2ReferenceBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
index e02547e727..9db4d85440 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.binding.ws.axis2.provider;
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.util.Iterator;
import javax.wsdl.Operation;
import javax.wsdl.PortType;
@@ -28,6 +29,7 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
@@ -156,7 +158,7 @@ public class Axis2ReferenceBindingInvoker implements Invoker {
requestMC.setTo( new EndpointReference(toAddress) );
if( isInvocationForCallback( msg ) ) {
- addWSAToHeader( sh, toAddress );
+ addWSAToHeader( sh, toAddress, msg );
addWSAActionHeader( sh );
addWSARelatesTo( sh, msg );
} // end if
@@ -204,13 +206,23 @@ public class Axis2ReferenceBindingInvoker implements Invoker {
} // end method addWSAFromHeader
- private void addWSAToHeader( SOAPHeader sh, String address ) {
+ private static String WS_REF_PARMS = "WS_REFERENCE_PARAMETERS";
+ private void addWSAToHeader( SOAPHeader sh, String address, Message msg ) {
// Create wsa:To header which is required by ws-addressing spec
-
OMElement wsaToOM = sh.getOMFactory().createOMElement(QNAME_WSA_TO);
wsaToOM.setText( address );
sh.addChild(wsaToOM);
+ // Deal with Reference Parameters, if present - copy to the header without the wsa:ReferenceParameters wrapper
+ OMElement refParms = (OMElement) msg.getHeaders().get(WS_REF_PARMS);
+ if( refParms != null ) {
+ Iterator<?> children = refParms.getChildren();
+ while( children.hasNext() ) {
+ OMNode node = (OMNode) children.next();
+ sh.addChild(node);
+ }
+ } // end if
+
} // end method addWSAActionHeader
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 d73879463e..4e3e085ee8 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
@@ -50,6 +50,8 @@ public class TuscanyServiceProvider {
new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS);
public static final QName QNAME_WSA_FROM =
new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM);
+ public static final QName QNAME_WSA_REPLYTO =
+ new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_REPLY_TO);
public static final QName QNAME_WSA_REFERENCE_PARAMETERS =
new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS);
public static final QName QNAME_WSA_MESSAGEID =
@@ -107,15 +109,7 @@ public class TuscanyServiceProvider {
//FIXME: can we use the Axis2 addressing support for this?
SOAPHeader header = inMC.getEnvelope().getHeader();
if (header != null) {
- OMElement from = header.getFirstChildWithName(QNAME_WSA_FROM);
- if (from != null) {
- OMElement callbackAddrElement = from.getFirstChildWithName(QNAME_WSA_ADDRESS);
- if (callbackAddrElement != null) {
- if (endpoint.getService().getInterfaceContract().getCallbackInterface() != null) {
- callbackAddress = callbackAddrElement.getText();
- }
- }
- } // end if
+ callbackAddress = handleCallbackAddress( header, msg );
// Retrieve other callback-related headers
handleMessageIDHeader( header, msg );
} // end if
@@ -149,6 +143,27 @@ public class TuscanyServiceProvider {
}
return response.getBody();
} // end method
+
+ private static String WS_REF_PARMS = "WS_REFERENCE_PARAMETERS";
+ private String handleCallbackAddress( SOAPHeader header, Message msg ) {
+ String callbackAddress = null;
+
+ OMElement from = header.getFirstChildWithName(QNAME_WSA_FROM);
+ if( from == null ) from = header.getFirstChildWithName(QNAME_WSA_REPLYTO);
+
+ if (from != null) {
+ OMElement callbackAddrElement = from.getFirstChildWithName(QNAME_WSA_ADDRESS);
+ if (callbackAddrElement != null) {
+ if (endpoint.getService().getInterfaceContract().getCallbackInterface() != null) {
+ callbackAddress = callbackAddrElement.getText();
+ }
+ OMElement refParms = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS);
+ if( refParms != null ) msg.getHeaders().put(WS_REF_PARMS, refParms);
+ }
+ } // end if
+
+ return callbackAddress;
+ } // end method handleCallbackAddress
private static String WS_MESSAGE_ID = "WS_MESSAGE_ID";
/**