You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2010/05/17 19:21:01 UTC
svn commit: r945249 - in
/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2:
META-INF/MANIFEST.MF
src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
Author: rfeng
Date: Mon May 17 17:21:00 2010
New Revision: 945249
URL: http://svn.apache.org/viewvc?rev=945249&view=rev
Log:
Add wsa:Action to the soap header as it's mandatory
Modified:
tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF
tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF?rev=945249&r1=945248&r2=945249&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/META-INF/MANIFEST.MF Mon May 17 17:21:00 2010
@@ -89,6 +89,7 @@ Import-Package: javax.activation;resolut
org.apache.axiom.soap,
org.apache.axis2,
org.apache.axis2.addressing,
+ org.apache.axis2.addressing.wsdl,
org.apache.axis2.client,
org.apache.axis2.context,
org.apache.axis2.deployment,
Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java?rev=945249&r1=945248&r2=945249&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/provider/Axis2ReferenceBindingInvoker.java Mon May 17 17:21:00 2010
@@ -22,6 +22,8 @@ import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
@@ -33,6 +35,7 @@ import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.addressing.wsdl.WSDL11ActionHelper;
import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
@@ -40,9 +43,11 @@ import org.apache.axis2.context.MessageC
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
+import org.oasisopen.sca.ServiceRuntimeException;
/**
@@ -57,6 +62,11 @@ public class Axis2ReferenceBindingInvoke
AddressingConstants.WSA_FROM,
AddressingConstants.WSA_DEFAULT_PREFIX);
+ public static final QName QNAME_WSA_ACTION =
+ new QName(AddressingConstants.Final.WSA_NAMESPACE,
+ AddressingConstants.WSA_ACTION,
+ AddressingConstants.WSA_DEFAULT_PREFIX);
+
private RuntimeEndpointReference endpointReference;
private ServiceClient serviceClient;
private QName wsdlOperationName;
@@ -134,6 +144,22 @@ public class Axis2ReferenceBindingInvoke
QNAME_WSA_FROM,
AddressingConstants.Final.WSA_NAMESPACE);
sh.addChild(epr);
+
+ // Create wsa:Action header which is required by ws-addressing spec
+ String action = options.getAction();
+
+ if (action == null) {
+ PortType portType = ((WSDLInterface)wsBinding.getBindingInterfaceContract().getInterface()).getPortType();
+ Operation op = portType.getOperation(wsdlOperationName.getLocalPart(), null, null);
+ action =
+ WSDL11ActionHelper.getActionFromInputElement(wsBinding.getWSDLDocument(), portType, op, op
+ .getInput());
+ }
+
+ OMElement actionOM = sev.getOMFactory().createOMElement(QNAME_WSA_ACTION);
+ actionOM.setText(action == null ? "" : action);
+ sh.addChild(actionOM);
+
requestMC.setFrom(fromEPR);
}
@@ -141,10 +167,10 @@ public class Axis2ReferenceBindingInvoke
// use dynamically specified target endpoint passed in on this call
if (options.getTo() == null) {
Endpoint ep = msg.getTo();
- if (ep != null) {
+ if (ep != null && ep.getBinding() != null) {
requestMC.setTo(new EndpointReference(ep.getBinding().getURI()));
} else {
- throw new RuntimeException("Unable to determine destination endpoint");
+ throw new ServiceRuntimeException("Unable to determine destination endpoint");
}
} else {
requestMC.setTo(new EndpointReference(options.getTo().getAddress()));