summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.3/modules/binding-ws-axis2/src
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-06-30 16:02:54 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2008-06-30 16:02:54 +0000
commit79c8907bf3b86c58ee515a355361a2f42ebc4776 (patch)
treee5c79c98ede4ea2bf2c735441897a14db89aca4c /branches/sca-java-1.3/modules/binding-ws-axis2/src
parenteb340a208f49de11848fb3c667279ca106ec3ff3 (diff)
Fix TUSCANY-2446
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@672803 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java50
-rw-r--r--branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java74
-rw-r--r--branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java10
-rw-r--r--branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java83
4 files changed, 66 insertions, 151 deletions
diff --git a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
index 6ce40b5eca..d4e3f47e6d 100644
--- a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
+++ b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
@@ -24,22 +24,17 @@ import java.util.Map;
import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.MessageFactory;
import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.xsd.XSDFactory;
+import org.osoa.sca.ServiceRuntimeException;
public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider {
@@ -55,50 +50,15 @@ public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider {
DataBindingExtensionPoint dataBindings) {
MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class);
- WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
this.wsBinding = wsBinding;
- InterfaceContract contract = wsBinding.getBindingInterfaceContract();
- if (contract == null) {
- contract = reference.getInterfaceContract().makeUnidirectional(false);
- if (contract instanceof JavaInterfaceContract) {
- ModelResolver resolver = component instanceof ResolverExtension ?
- ((ResolverExtension)component).getModelResolver() : null;
- contract = Java2WSDLHelper.createWSDLInterfaceContract(
- (JavaInterfaceContract)contract,
- Axis2ServiceBindingProvider.requiresSOAP12(wsBinding),
- resolver,
- dataBindings,
- wsdlFactory,
- xsdFactory);
- }
- wsBinding.setBindingInterfaceContract(contract);
- }
-
- // TODO - fix up the conversational flag and operation sequences in case the contract has come from WSDL
- // as we don't yet support requires="conversational" or sca:endConversation annotations
- // in WSDL interface descriptions (see section 1.5.4 of the Assembly Specification V1.0)
- if ( reference.getInterfaceContract().getInterface() != null && contract.getInterface() != null) {
- contract.getInterface().setConversational(reference.getInterfaceContract().getInterface().isConversational());
-
- for (Operation operation : contract.getInterface().getOperations()){
- Operation referenceOperation = null;
-
- for (Operation tmpOp : reference.getInterfaceContract().getInterface().getOperations()){
- if ( operation.getName().equals(tmpOp.getName())) {
- referenceOperation = tmpOp;
- break;
- }
- }
-
- if (referenceOperation != null ){
- operation.setConversationSequence(referenceOperation.getConversationSequence());
- }
- }
+ // A WSDL document should always be present in the binding
+ if (wsBinding.getWSDLDocument() == null) {
+ throw new ServiceRuntimeException("No WSDL document for " + component.getName() + "/" + reference.getName());
}
// Set to use the Axiom data binding
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
if (contract.getInterface() != null) {
contract.getInterface().resetDataBinding(OMElement.class.getName());
}
diff --git a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
index 9afd1283c1..e35972ea00 100644
--- a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
+++ b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
@@ -26,23 +26,15 @@ import javax.xml.namespace.QName;
import org.apache.axiom.om.OMElement;
import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
import org.apache.tuscany.sca.host.http.ServletHost;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.java2wsdl.Java2WSDLHelper;
import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
import org.apache.tuscany.sca.provider.ServiceBindingProvider;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.xsd.XSDFactory;
+import org.osoa.sca.ServiceRuntimeException;
public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
@@ -58,58 +50,15 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
DataBindingExtensionPoint dataBindings) {
MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class);
- WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
this.wsBinding = wsBinding;
- InterfaceContract contract = wsBinding.getBindingInterfaceContract();
- if (contract == null) {
- contract = service.getInterfaceContract().makeUnidirectional(false);
- if (contract instanceof JavaInterfaceContract) {
- ModelResolver resolver = component instanceof ResolverExtension ?
- ((ResolverExtension)component).getModelResolver() : null;
- contract = Java2WSDLHelper.createWSDLInterfaceContract(
- (JavaInterfaceContract)contract,
- requiresSOAP12(wsBinding),
- resolver,
- dataBindings,
- wsdlFactory,
- xsdFactory);
- } else {
- try {
- //TUSCANY-2316 Cloning the Interface Contract to avoid overriding data biding information
- contract = (InterfaceContract) contract.clone();
- } catch (Exception e) {
- //ignore
- }
- }
- wsBinding.setBindingInterfaceContract(contract);
- }
-
- // TODO - fix up the conversational flag and operation sequences in case the contract has come from WSDL
- // as we don't yet support requires="conversational" or sca:endConversation annotations
- // in WSDL interface descriptions (see section 1.5.4 of the Assembly Specification V1.0)
- if (service.getInterfaceContract().getInterface() != null ) {
- contract.getInterface().setConversational(service.getInterfaceContract().getInterface().isConversational());
-
- for (Operation operation : contract.getInterface().getOperations()){
- Operation serviceOperation = null;
-
- for (Operation tmpOp : service.getInterfaceContract().getInterface().getOperations()){
- if ( operation.getName().equals(tmpOp.getName())) {
- serviceOperation = tmpOp;
- break;
- }
- }
-
- if (serviceOperation != null ){
- operation.setConversationSequence(serviceOperation.getConversationSequence());
- }
- }
+ // A WSDL document should always be present in the binding
+ if (wsBinding.getWSDLDocument() == null) {
+ throw new ServiceRuntimeException("No WSDL document for " + component.getName() + "/" + service.getName());
}
-
// Set to use the Axiom data binding
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
contract.getInterface().resetDataBinding(OMElement.class.getName());
axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory, policyHandlerClassnames);
@@ -131,17 +80,4 @@ public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
return true;
}
- private static final QName SOAP12_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0", "soap.1_2");
-
- protected static boolean requiresSOAP12(WebServiceBinding wsBinding) {
- if (wsBinding instanceof IntentAttachPoint) {
- List<Intent> intents = ((IntentAttachPoint)wsBinding).getRequiredIntents();
- for (Intent intent : intents) {
- if (SOAP12_INTENT.equals(intent.getName())) {
- return true;
- }
- }
- }
- return false;
- }
}
diff --git a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
index 5835ea78fe..bfc805803e 100644
--- a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
+++ b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
@@ -116,16 +116,6 @@ public class Axis2ServiceClient {
this.contract = contract;
this.wsBinding = wsBinding;
this.policyHandlerClassnames = policyHandlerClassnames;
- Definition definition = wsBinding.getWSDLDocument();
- if (definition != null) {
- // Can happen if a self-reference. Reuse the service's WSDL configuration.
- // In theory this is just a useful optimization but in practice I found
- // it was needed to make the JUnit test for the helloworld-ws-service-jms
- // sample run.
- } else {
- definition = Axis2WSDLHelper.configureWSDLDefinition(wsBinding, component, contract, servletHost);
- wsBinding.setWSDLDocument(definition);
- }
}
protected void start() {
diff --git a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
index 1bfd20e937..de6f7c2c21 100644
--- a/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
+++ b/branches/sca-java-1.3/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
@@ -141,6 +141,8 @@ public class Axis2ServiceProvider {
public static final QName QNAME_WSA_REFERENCE_PARAMETERS =
new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS);
+ private static final QName TRANSPORT_JMS_QUALIFIED_INTENT =
+ new QName("http://www.osoa.org/xmlns/sca/1.0", "transport.jms");
private static final String DEFAULT_QUEUE_CONNECTION_FACTORY = "TuscanyQueueConnectionFactory";
//Schema element names
@@ -194,39 +196,66 @@ public class Axis2ServiceProvider {
configContext.setContextRoot(servletHost.getContextPath());
- /*
- // Look at all the Web Service bindings of the SCA service to see if any
- // of them have an existing generated WSDL definitions document. If found,
- // use it for this binding as well. If not found, generate a new document.
- Definition definition = null;
- for (Binding binding : contract.getBindings()) {
- if (binding instanceof WebServiceBinding) {
- definition = ((WebServiceBinding)binding).getWSDLDocument();
- if (definition != null) {
- wsBinding.setWSDLDocument(definition);
- break;
- }
- }
+ // Update port addresses with runtime information, and create a
+ // map from endpoint URIs to WSDL ports that eliminates duplicate
+ // ports for the same endpoint.
+ for (Object port : wsBinding.getService().getPorts().values()) {
+ String portAddress = getPortAddress((Port)port);
+ String endpointURI = computeEndpointURI(portAddress, servletHost);
+ setPortAddress((Port)port, endpointURI);
+ urlMap.put(endpointURI, (Port)port);
}
- */
- // The above code is disabled temporarily. Instead, we only look
- // for a WSDL definitions document in this binding and don't
- // attempt to share the same document across multiple bindings.
- Definition definition = wsBinding.getWSDLDocument();
+ }
- // generate a WSDL definitions document if needed
- if (definition == null) {
- definition = Axis2WSDLHelper.configureWSDLDefinition(wsBinding, component, contract, servletHost);
- wsBinding.setWSDLDocument(definition);
+ private String computeEndpointURI(String uri, ServletHost servletHost) {
+
+ if (uri == null) {
+ return null;
}
- // The generated WSDL document maps ports to endpoint URLs. Create a
- // reverse map that eliminates duplicate ports for the same endpoint.
- for (Object port : wsBinding.getService().getPorts().values()) {
- urlMap.put(getPortAddress((Port)port), (Port)port);
+ // pull out the binding intents to see what sort of transport is required
+ PolicySet transportJmsPolicySet = AxisPolicyHelper.getPolicySet(wsBinding, TRANSPORT_JMS_QUALIFIED_INTENT);
+ if (transportJmsPolicySet != null){
+ if (!uri.startsWith("jms:/")) {
+ uri = "jms:" + uri;
+ }
+
+ // construct the rest of the URI based on the policy. All the details are put
+ // into the URI here rather than being place directly into the Axis configuration
+ // as the Axis JMS sender relies on parsing the target URI
+ Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
+ for ( Object policy : transportJmsPolicySet.getPolicies() ) {
+ if ( policy instanceof Axis2ConfigParamPolicy ) {
+ axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
+ Iterator paramIterator = axis2ConfigParamPolicy.getParamElements().get(DEFAULT_QUEUE_CONNECTION_FACTORY).getChildElements();
+
+ if (paramIterator.hasNext()){
+ StringBuffer uriParams = new StringBuffer("?");
+
+ while (paramIterator.hasNext()){
+ OMElement parameter = (OMElement)paramIterator.next();
+ uriParams.append(parameter.getAttributeValue(new QName("","name")));
+ uriParams.append("=");
+ uriParams.append(parameter.getText());
+
+ if (paramIterator.hasNext()){
+ uriParams.append("&");
+ }
+ }
+
+ uri = uri + uriParams;
+ }
+ }
+ }
+ } else {
+ if (!uri.startsWith("jms:")) {
+ uri = servletHost.getURLMapping(uri).toString();
+ }
}
+
+ return uri;
}
-
+
public void start() {
try {