summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-26 12:41:11 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-08-26 12:41:11 +0000
commitf5d98d5e2a84c66a931d877df4bb4c7bf851b376 (patch)
tree5cff2748d5c1a95a3a8b16ddd1a13b2b778ef53e /sca-java-2.x
parentc0e362c81eecf5215c58846fba7de9160ac70af1 (diff)
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
Diffstat (limited to 'sca-java-2.x')
-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.java6
-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.java12
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java23
3 files changed, 39 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/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
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
index e10ecf178b..9dba10f605 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
@@ -24,6 +24,7 @@ import java.util.List;
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
import org.apache.tuscany.sca.assembly.builder.BuilderContext;
import org.apache.tuscany.sca.context.CompositeContext;
@@ -131,6 +132,26 @@ public class CallbackServiceReferenceImpl<B> extends ServiceReferenceImpl<B> {
epr.setTargetEndpoint(resolvedEndpoint);
// TUSCANY-3932
+ // If it's the default binding then we're going to look the callback endpoint
+ // up in the registry. Most remote protocols, which may be used as delegates
+ // or binding.sca will deal in absolution callback address and send the
+ // callback enbdpoint strutural URL separately. In this case flip the binding
+ // back to the structure URL.
+ // TODO - all this creation of endpoints by the binding to represent callbacks
+ // is confusing. Code here will change if we tidy it up.
+ if (epr.getBinding().getType().equals(SCABinding.TYPE)){
+ // assume that we're going to look up the callback endpoint in the
+ // registry
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ if (msgContext != null){
+ String callbackEPURI = (String)msgContext.getHeaders().get("CALLBACK_EP_URI");
+ if (callbackEPURI != null){
+ resolvedEndpoint.setURI(callbackEPURI);
+ }
+ }
+ }
+/*
+ // TUSCANY-3932
// If the resolved endpoint has a binding with a absolute URI then assume
// that URL has been passed in in the forward message and really treat it
// as a resolved endpoint.
@@ -151,7 +172,7 @@ public class CallbackServiceReferenceImpl<B> extends ServiceReferenceImpl<B> {
epr.setUnresolved(false);
}
}
-
+*/
return epr;
} catch (CloneNotSupportedException e) {
// will not happen