summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2
diff options
context:
space:
mode:
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/context/WSAxis2BindingContext.java58
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java4
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.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/Axis2ReferenceBindingInvoker.java8
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInMessageReceiver.java2
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInOutSyncMessageReceiver.java2
-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.java9
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/transport/TransportReferenceInterceptor.java8
8 files changed, 88 insertions, 9 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/context/WSAxis2BindingContext.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/context/WSAxis2BindingContext.java
new file mode 100644
index 0000000000..e9b388f793
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/context/WSAxis2BindingContext.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.ws.axis2.context;
+
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.context.MessageContext;
+
+/**
+ * Context that the WS Axis2 binding puts on the Tuscany wire
+ *
+ * @version $Rev: 813727 $ $Date: 2009-09-11 10:02:58 +0100 (Fri, 11 Sep 2009) $
+ */
+public class WSAxis2BindingContext {
+
+ private OperationClient axisOperationClient;
+ private MessageContext axisInMessageContext;
+ private MessageContext axisOutMessageContext;
+
+ public OperationClient getAxisOperationClient() {
+ return axisOperationClient;
+ }
+
+ public void setAxisOperationClient(OperationClient axisOperationClient) {
+ this.axisOperationClient = axisOperationClient;
+ }
+
+ public MessageContext getAxisInMessageContext() {
+ return axisInMessageContext;
+ }
+
+ public void setAxisInMessageContext(MessageContext axisInMessageContext) {
+ this.axisInMessageContext = axisInMessageContext;
+ }
+
+ public MessageContext getAxisOutMessageContext() {
+ return axisOutMessageContext;
+ }
+
+ public void setAxisOutMessageContext(MessageContext axisOutMessageContext) {
+ this.axisOutMessageContext = axisOutMessageContext;
+ }
+}
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java
index 04b46485d8..78a150b0b4 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java
@@ -28,6 +28,7 @@ import org.apache.axis2.client.OperationClient;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.apache.axis2.transport.http.HttpTransportProperties.Authenticator;
+import org.apache.tuscany.sca.binding.ws.axis2.context.WSAxis2BindingContext;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.Phase;
@@ -74,7 +75,8 @@ public class BasicAuthenticationReferencePolicyInterceptor implements PhasedInte
public Message invoke(Message msg) {
- OperationClient operationClient = msg.getBindingContext();
+ WSAxis2BindingContext bindingContext = msg.getBindingContext();
+ OperationClient operationClient = bindingContext.getAxisOperationClient();
String username = null;
String password = null;
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
index 5365754fb3..33e623135f 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
@@ -25,7 +25,9 @@ import javax.security.auth.Subject;
import javax.xml.namespace.QName;
import org.apache.axiom.util.base64.Base64Utils;
+import org.apache.axis2.client.OperationClient;
import org.apache.axis2.context.MessageContext;
+import org.apache.tuscany.sca.binding.ws.axis2.context.WSAxis2BindingContext;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.invocation.Phase;
@@ -74,7 +76,9 @@ public class BasicAuthenticationServicePolicyInterceptor implements PhasedInterc
public Message invoke(Message msg) {
- MessageContext messageContext = msg.getBindingContext();
+ WSAxis2BindingContext bindingContext = msg.getBindingContext();
+ MessageContext messageContext = bindingContext.getAxisInMessageContext();
+
Map httpHeaderProperties = (Map)messageContext.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
String basicAuthString = (String)httpHeaderProperties.get("Authorization");
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 3f3e63951b..c163117d59 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
@@ -54,6 +54,7 @@ import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.axis2.context.WSAxis2BindingContext;
import org.apache.tuscany.sca.context.CompositeContext;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
@@ -113,7 +114,12 @@ public class Axis2ReferenceBindingInvoker implements Invoker {
public Message invoke(Message msg) {
try {
final OperationClient operationClient = createOperationClient(msg);
- msg.setBindingContext(operationClient);
+ WSAxis2BindingContext bindingContext = new WSAxis2BindingContext();
+ bindingContext.setAxisOperationClient(operationClient);
+ bindingContext.setAxisOutMessageContext(operationClient.getMessageContext("Out"));
+ bindingContext.setAxisOutMessageContext(operationClient.getMessageContext("In"));
+ msg.setBindingContext(bindingContext);
+
msg = endpointReference.getBindingInvocationChain().getHeadInvoker().invoke(msg);
if (wsBinding.isRpcLiteral()){
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInMessageReceiver.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInMessageReceiver.java
index 65e95ba34e..d23dc7e8ca 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInMessageReceiver.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInMessageReceiver.java
@@ -41,7 +41,7 @@ public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver {
try {
OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
- provider.invoke(requestOM, inMC);
+ provider.invoke(requestOM, inMC, null);
} catch (InvocationTargetException e) {
Throwable t = e.getCause();
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInOutSyncMessageReceiver.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInOutSyncMessageReceiver.java
index d6694c9f7d..9617ba036c 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInOutSyncMessageReceiver.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ServiceInOutSyncMessageReceiver.java
@@ -48,7 +48,7 @@ public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessa
try {
OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
- OMElement responseOM = (OMElement)provider.invoke(requestOM, inMC);
+ OMElement responseOM = (OMElement)provider.invoke(requestOM, inMC, outMC);
SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope();
if (null != responseOM ) {
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 70875916df..4fe29da9c3 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
@@ -43,6 +43,7 @@ import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.axis2.context.WSAxis2BindingContext;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
@@ -110,13 +111,17 @@ public class TuscanyServiceProvider {
}
} // end method checkCallbackAddress
- public OMElement invoke(OMElement requestOM, MessageContext inMC) throws InvocationTargetException, AxisFault {
+ public OMElement invoke(OMElement requestOM, MessageContext inMC, MessageContext outMC) throws InvocationTargetException, AxisFault {
String callbackAddress = null;
// create a message object and set the args as its body
Message msg = messageFactory.createMessage();
msg.setOperation(operation);
- msg.setBindingContext(inMC);
+ WSAxis2BindingContext bindingContext = new WSAxis2BindingContext();
+ bindingContext.setAxisOutMessageContext(inMC);
+ bindingContext.setAxisOutMessageContext(outMC); //TUSCANY-3881
+ msg.setBindingContext(bindingContext);
+
if (wsBinding.isRpcLiteral()){
// remove the wrapping element containing
diff --git a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/transport/TransportReferenceInterceptor.java b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/transport/TransportReferenceInterceptor.java
index 7daa58bf29..888a9f6a79 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/transport/TransportReferenceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/transport/TransportReferenceInterceptor.java
@@ -28,6 +28,7 @@ import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.tuscany.sca.binding.ws.axis2.context.WSAxis2BindingContext;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
@@ -72,7 +73,8 @@ public class TransportReferenceInterceptor implements Interceptor {
}
protected Object invokeTarget(Message msg) throws AxisFault {
- final OperationClient operationClient = msg.getBindingContext();
+ WSAxis2BindingContext bindingContext = msg.getBindingContext();
+ final OperationClient operationClient = bindingContext.getAxisOperationClient();
// ensure connections are tracked so that they can be closed by the reference binding
MessageContext requestMC = operationClient.getMessageContext("Out");
@@ -95,6 +97,7 @@ public class TransportReferenceInterceptor implements Interceptor {
}
MessageContext responseMC = operationClient.getMessageContext("In");
+ bindingContext.setAxisInMessageContext(responseMC);
OMElement response = responseMC.getEnvelope().getBody().getFirstElement();
@@ -111,7 +114,8 @@ public class TransportReferenceInterceptor implements Interceptor {
}
protected Object invokeTargetOneWay(Message msg) throws AxisFault {
- OperationClient operationClient = msg.getBindingContext();
+ WSAxis2BindingContext bindingContext = msg.getBindingContext();
+ OperationClient operationClient = bindingContext.getAxisOperationClient();
// ensure connections are tracked so that they can be closed by the reference binding
MessageContext requestMC = operationClient.getMessageContext("Out");