From f5d98d5e2a84c66a931d877df4bb4c7bf851b376 Mon Sep 17 00:00:00 2001 From: slaws Date: Fri, 26 Aug 2011 12:41:11 +0000 Subject: TUSCANY-3932 - sample of how the structural URI could be passed over a remote binding (in this case binding.ws) and picked up on the service side in the binding.sca case. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1162090 13f79535-47bb-0310-9956-ffa450edef68 --- .../ws/axis2/provider/Axis2ReferenceBindingInvoker.java | 6 ++++++ .../binding/ws/axis2/provider/TuscanyServiceProvider.java | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java') 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 c7b81ccac1..4397dfaa10 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 @@ -89,6 +89,7 @@ public class Axis2ReferenceBindingInvoker implements Invoker { public static final QName QNAME_WSA_MESSAGEID = new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_MESSAGE_ID, AddressingConstants.WSA_DEFAULT_PREFIX); + public static final QName QNAME_CALLACK_EP_URI = new QName(org.apache.tuscany.sca.assembly.xml.Constants.SCA11_TUSCANY_NS, "CALLBACK_EP_URI"); private RuntimeEndpointReference endpointReference; private ServiceClient serviceClient; @@ -243,6 +244,11 @@ public class Axis2ReferenceBindingInvoker implements Invoker { if (callbackEndpoint != null) { // Load the actual callback endpoint URI into an Axis EPR ready to form the content of the wsa:From header EndpointReference fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI()); + + // pass the callback structure URI as a reference parameter + // this allows callback endpoints to be looked up via the registry when + // the ws binding is being used as a delegate from the sca binding + fromEPR.addReferenceParameter(QNAME_CALLACK_EP_URI, callbackEndpoint.getURI()); addWSAFromHeader( sh, fromEPR ); addWSAActionHeader( sh ); 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 9b76f7e7ea..04257f9b55 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 @@ -252,7 +252,17 @@ public class TuscanyServiceProvider { if (callbackAddrElement != null) { callbackAddress = callbackAddrElement.getText(); OMElement refParms = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS); - if( refParms != null ) msg.getHeaders().put(WS_REF_PARMS, refParms); + if( refParms != null ) { + msg.getHeaders().put(WS_REF_PARMS, refParms); + Iterator iter = refParms.getChildrenWithLocalName("CALLBACK_EP_URI"); + if (iter != null && iter.hasNext()){ + OMElement callbackEPURI = (OMElement)iter.next(); + if (callbackEPURI != null){ + msg.getHeaders().put("CALLBACK_EP_URI", callbackEPURI.getText()); + } + } + } + } } // end if -- cgit v1.2.3