You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2007/04/13 14:19:36 UTC
svn commit: r528453 - in
/incubator/tuscany/java/sca/modules/binding-ws-axis2: ./
src/main/java/org/apache/tuscany/binding/axis2/
src/main/resources/META-INF/sca/
Author: antelder
Date: Fri Apr 13 05:19:35 2007
New Revision: 528453
URL: http://svn.apache.org/viewvc?view=rev&rev=528453
Log:
More axis binding bringup - start getting a reference to be invoked
Added:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ModuleActivator.java (with props)
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2WSReference.java (with props)
Removed:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/META-INF/sca/
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml?view=diff&rev=528453&r1=528452&r2=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/pom.xml Fri Apr 13 05:19:35 2007
@@ -74,13 +74,11 @@
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws</artifactId>
<version>1.0-incubating-SNAPSHOT</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-ws-xml</artifactId>
<version>1.0-incubating-SNAPSHOT</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?view=diff&rev=528453&r1=528452&r2=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Fri Apr 13 05:19:35 2007
@@ -18,316 +18,291 @@
*/
package org.apache.tuscany.binding.axis2;
-import java.net.URI;
-
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
+import org.apache.tuscany.assembly.CompositeReference;
import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
-import org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector;
-import org.apache.tuscany.idl.wsdl.WSDLDefinitionRegistry;
-import org.apache.tuscany.idl.wsdl.WSDLServiceContract;
-import org.apache.tuscany.spi.builder.BuilderConfigException;
+import org.apache.tuscany.binding.ws.WebServiceBinding;
import org.apache.tuscany.spi.builder.BuilderException;
import org.apache.tuscany.spi.component.ReferenceBinding;
-import org.apache.tuscany.spi.component.ServiceBinding;
-import org.apache.tuscany.spi.component.WorkContext;
import org.apache.tuscany.spi.deployer.DeploymentContext;
import org.apache.tuscany.spi.extension.BindingBuilderExtension;
-import org.apache.tuscany.spi.host.ServletHost;
-import org.apache.tuscany.spi.idl.InvalidServiceContractException;
-import org.apache.tuscany.spi.model.ReferenceDefinition;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.model.ServiceDefinition;
-import org.osoa.sca.annotations.Reference;
/**
* Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.ReferenceBinding} configured
* with the Axis2 binding
- *
- * @version $Rev$ $Date$
*/
-@SuppressWarnings("deprecation")
-public class Axis2BindingBuilder extends BindingBuilderExtension<WebServiceBindingDefinition> {
+public class Axis2BindingBuilder extends BindingBuilderExtension<WebServiceBinding> {
private static final String OM_DATA_BINDING = OMElement.class.getName();
// TODO: what to do about the base URI?
private static final String BASE_URI = "http://localhost:8080/";
- private ServletHost servletHost;
+// private ServletHost servletHost;
private ConfigurationContext configContext;
+//
+// private WorkContext workContext;
- private InterfaceWSDLIntrospector introspector;
-
- private WorkContext workContext;
-
- private WSDLDefinitionRegistry wsdlReg;
-
- public Axis2BindingBuilder() throws BuilderConfigException {
+ public Axis2BindingBuilder() {
initAxis();
}
- @Reference(required = false)
- public void setServletHost(ServletHost servletHost) {
- this.servletHost = servletHost;
- }
-
- /**
- * @param introspector the introspector to set
- */
- @Reference
- public void setIntrospector(InterfaceWSDLIntrospector introspector) {
- this.introspector = introspector;
- }
-
- @Reference
- public void setWorkContext(WorkContext workContext) {
- this.workContext = workContext;
+// public void setServletHost(ServletHost servletHost) {
+// this.servletHost = servletHost;
+// }
+//
+// public void setWorkContext(WorkContext workContext) {
+// this.workContext = workContext;
+// }
+
+ @Override
+ protected Class<WebServiceBinding> getBindingType() {
+ return WebServiceBinding.class;
}
- @Reference
- public void setWSDLDefinitionRegistry(WSDLDefinitionRegistry wsdlReg) {
- this.wsdlReg = wsdlReg;
+ public ReferenceBinding build(CompositeReference boundReferenceDefinition,
+ WebServiceBinding bindingDefinition,
+ DeploymentContext context) throws BuilderException {
+ return new Axis2WSReference(null, null);
}
-
- @SuppressWarnings("unchecked")
- public ServiceBinding build(
- ServiceDefinition serviceDefinition,
- WebServiceBindingDefinition wsBinding, DeploymentContext deploymentContext) {
-
- try {
- // Set the default databinding
- ServiceContract outboundContract = serviceDefinition.getServiceContract();
- if (outboundContract instanceof WSDLServiceContract) {
- outboundContract.setDataBinding(OM_DATA_BINDING);
- }
-
- // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
- if (wsBinding.getWSDLDefinition() == null) {
- if (outboundContract instanceof WSDLServiceContract) {
- String ns = ((WSDLServiceContract)outboundContract).getPortType().getQName().getNamespaceURI();
- wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
- } else {
- throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
- }
- }
-
- // FIXME: We need to define how the WSDL PortType is honored in the case that
- // both the service.ws and interface.wsdl are in place.
- // The WSDL portType from the WSDL Port decides the incoming SOAP message format
- // There are also cases that interface.java is used.
-
- ServiceContract<?> inboundContract;
- Port port = wsBinding.getWSDLPort();
- if (port == null) {
- // FIXME: [rfeng] No WSDL is referenced by service.ws, we need to create one from
- // the outbound service contract if it's JavaServiceContract
- inboundContract = outboundContract;
- }
-
- PortType portType = wsBinding.getWSDLPort().getBinding().getPortType();
- inboundContract = introspector.introspect(portType);
-
- // FIXME:
- inboundContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass());
- inboundContract.setDataBinding(OM_DATA_BINDING);
- inboundContract.setCallbackName(serviceDefinition.getServiceContract().getCallbackName());
-
-// inboundContract.setInteractionScope(serviceDefinition.getServiceContract().getInteractionScope()); // TODO: gone
-
-// TODO: gone
-// try {
-// wireService.checkCompatibility(inboundContract, outboundContract, true);
-// } catch (IncompatibleServiceContractException e) {
-// throw new Axis2BindingBuilderRuntimeException(e);
-// }
-
- URI axisServiceName;
- if (wsBinding.isSpec10Compliant()) {
- wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, serviceDefinition.getTarget(), serviceDefinition.getUri()));
- String name = wsBinding.getActualURI().getPath();
- if (name != null && name.length() > 1 && name.startsWith("/")) {
- name = name.substring(1);
- }
- axisServiceName = URI.create(name);
- } else {
- axisServiceName = serviceDefinition.getUri(); // TODO: verify name
- }
-
- ServiceBinding serviceBinding =
- new Axis2ServiceBinding(axisServiceName, outboundContract, inboundContract, wsBinding,
- servletHost, configContext, workContext);
- return serviceBinding;
-
- } catch (InvalidServiceContractException e) {
- throw new Axis2BindingBuilderRuntimeException(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- public ReferenceBinding build(
- ReferenceDefinition boundReferenceDefinition,
- WebServiceBindingDefinition wsBinding,
- DeploymentContext deploymentContext) {
-
- // Set the default binding
- ServiceContract inboundContract = boundReferenceDefinition.getServiceContract();
- if (inboundContract instanceof WSDLServiceContract) {
- inboundContract.setDataBinding(OM_DATA_BINDING);
- }
-
- // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
- if (wsBinding.getWSDLDefinition() == null) {
- if (inboundContract instanceof WSDLServiceContract) {
- String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI();
- wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
- } else {
- throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
- }
- }
-
- // FIXME: We need to define how the WSDL PortType is honored in the case that
- // both the binding.ws and interface.wsdl are in place
- // The WSDL portType from the WSDL Port decides the incoming SOAP message format
-
- ServiceContract<?> outboundContract = inboundContract;
- Port port = wsBinding.getWSDLPort();
- if (port == null) {
- // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from
- // the inbound service contract if it's JavaServiceContract
- outboundContract = inboundContract;
- }
- PortType portType = port.getBinding().getPortType();
- try {
- outboundContract = introspector.introspect(portType);
- } catch (InvalidServiceContractException e) {
- new Axis2BindingBuilderRuntimeException(e);
- }
-
- // Set the default databinding
- outboundContract.setDataBinding(OM_DATA_BINDING);
- //FIXME ... need to figure out how to specify scope on wsdl.
-// outboundContract.setInteractionScope(inboundContract.getInteractionScope()); // methdod gone
-
-// TODO: gone
+
+// @SuppressWarnings("unchecked")
+// public ServiceBinding build(
+// ServiceDefinition serviceDefinition,
+// WebServiceBindingDefinition wsBinding, DeploymentContext deploymentContext) {
+//
// try {
-// wireService.checkCompatibility(inboundContract, outboundContract, true);
-// } catch (IncompatibleServiceContractException e) {
+// // Set the default databinding
+// ServiceContract outboundContract = serviceDefinition.getServiceContract();
+// if (outboundContract instanceof WSDLServiceContract) {
+// outboundContract.setDataBinding(OM_DATA_BINDING);
+// }
+//
+// // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
+// if (wsBinding.getWSDLDefinition() == null) {
+// if (outboundContract instanceof WSDLServiceContract) {
+// String ns = ((WSDLServiceContract)outboundContract).getPortType().getQName().getNamespaceURI();
+// wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
+// } else {
+// throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
+// }
+// }
+//
+// // FIXME: We need to define how the WSDL PortType is honored in the case that
+// // both the service.ws and interface.wsdl are in place.
+// // The WSDL portType from the WSDL Port decides the incoming SOAP message format
+// // There are also cases that interface.java is used.
+//
+// ServiceContract<?> inboundContract;
+// Port port = wsBinding.getWSDLPort();
+// if (port == null) {
+// // FIXME: [rfeng] No WSDL is referenced by service.ws, we need to create one from
+// // the outbound service contract if it's JavaServiceContract
+// inboundContract = outboundContract;
+// }
+//
+// PortType portType = wsBinding.getWSDLPort().getBinding().getPortType();
+// inboundContract = introspector.introspect(portType);
+//
+// // FIXME:
+// inboundContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass());
+// inboundContract.setDataBinding(OM_DATA_BINDING);
+// inboundContract.setCallbackName(serviceDefinition.getServiceContract().getCallbackName());
+//
+//// inboundContract.setInteractionScope(serviceDefinition.getServiceContract().getInteractionScope()); // TODO: gone
+//
+//// TODO: gone
+//// try {
+//// wireService.checkCompatibility(inboundContract, outboundContract, true);
+//// } catch (IncompatibleServiceContractException e) {
+//// throw new Axis2BindingBuilderRuntimeException(e);
+//// }
+//
+// URI axisServiceName;
+// if (wsBinding.isSpec10Compliant()) {
+// wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, serviceDefinition.getTarget(), serviceDefinition.getUri()));
+// String name = wsBinding.getActualURI().getPath();
+// if (name != null && name.length() > 1 && name.startsWith("/")) {
+// name = name.substring(1);
+// }
+// axisServiceName = URI.create(name);
+// } else {
+// axisServiceName = serviceDefinition.getUri(); // TODO: verify name
+// }
+//
+// ServiceBinding serviceBinding =
+// new Axis2ServiceBinding(axisServiceName, outboundContract, inboundContract, wsBinding,
+// servletHost, configContext, workContext);
+// return serviceBinding;
+//
+// } catch (InvalidServiceContractException e) {
// throw new Axis2BindingBuilderRuntimeException(e);
// }
-
- if (wsBinding.isSpec10Compliant()) {
- wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, null, boundReferenceDefinition.getUri()));
- }
-
- return new Axis2ReferenceBinding(boundReferenceDefinition.getUri(), wsBinding,
- inboundContract, outboundContract, workContext);
-
- }
-
- protected Class<WebServiceBindingDefinition> getBindingType() {
- return WebServiceBindingDefinition.class;
- }
-
- protected void initAxis() throws BuilderConfigException {
+// }
+//
+// @SuppressWarnings("unchecked")
+// @Override
+// public ReferenceBinding buildx(
+// ReferenceDefinition boundReferenceDefinition,
+// WebServiceBinding wsBinding,
+// DeploymentContext deploymentContext) {
+//
+// // Set the default binding
+// ServiceContract inboundContract = boundReferenceDefinition.getServiceContract();
+// if (inboundContract instanceof WSDLServiceContract) {
+// inboundContract.setDataBinding(OM_DATA_BINDING);
+// }
+//
+// // TODO: TUSCANY-1148, <binding.ws> with no wsdl only works with <interface.wsdl>
+// if (wsBinding.getWSDLDefinition() == null) {
+// if (inboundContract instanceof WSDLServiceContract) {
+// String ns = ((WSDLServiceContract)inboundContract).getPortType().getQName().getNamespaceURI();
+// wsBinding.setWSDLDefinition(wsdlReg.getDefinition(ns));
+// } else {
+// throw new IllegalStateException("<binding.ws> with no WSDL requires using <interface.wsdl>");
+// }
+// }
+//
+// // FIXME: We need to define how the WSDL PortType is honored in the case that
+// // both the binding.ws and interface.wsdl are in place
+// // The WSDL portType from the WSDL Port decides the incoming SOAP message format
+//
+// ServiceContract<?> outboundContract = inboundContract;
+// Port port = wsBinding.getWSDLPort();
+// if (port == null) {
+// // FIXME: [rfeng] No WSDL is referenced by binding.ws, we need to create one from
+// // the inbound service contract if it's JavaServiceContract
+// outboundContract = inboundContract;
+// }
+// PortType portType = port.getBinding().getPortType();
+// try {
+// outboundContract = introspector.introspect(portType);
+// } catch (InvalidServiceContractException e) {
+// new Axis2BindingBuilderRuntimeException(e);
+// }
+//
+// // Set the default databinding
+// outboundContract.setDataBinding(OM_DATA_BINDING);
+// //FIXME ... need to figure out how to specify scope on wsdl.
+//// outboundContract.setInteractionScope(inboundContract.getInteractionScope()); // methdod gone
+//
+//// TODO: gone
+//// try {
+//// wireService.checkCompatibility(inboundContract, outboundContract, true);
+//// } catch (IncompatibleServiceContractException e) {
+//// throw new Axis2BindingBuilderRuntimeException(e);
+//// }
+//
+// if (wsBinding.isSpec10Compliant()) {
+// wsBinding.setActualURI(computeActualURI(wsBinding, BASE_URI, null, boundReferenceDefinition.getUri()));
+// }
+//
+// return new Axis2ReferenceBinding(boundReferenceDefinition.getUri(), wsBinding,
+// inboundContract, outboundContract, workContext);
+//
+// }
+//
+// protected Class<WebServiceBindingDefinition> getBindingType() {
+// return WebServiceBindingDefinition.class;
+// }
+//
+ protected void initAxis() {
// TODO: consider having a system component wrapping the Axis2 ConfigContext
try {
this.configContext = new TuscanyAxisConfigurator().getConfigurationContext();
} catch (AxisFault e) {
- throw new BuilderConfigException(e);
- }
- }
-
- /**
- * Compute the endpoint URI based on section 2.1.1 of the WS binding spec
- * 1. The URIs in the endpoint(s) of the referenced WSDL, which may be relative
- * 2. The URI specified by the wsa:Address element of the wsa:EndpointReference, which may be relative
- * 3. The explicitly stated URI in the "uri" attribute of the binding.ws element, which may be relative,
- * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec
- * If the <binding.ws> has no wsdlElement but does have a uri attribute then the uri takes precidence
- * over any implicitly used WSDL.
- * @param parent
- */
- protected URI computeActualURI(WebServiceBindingDefinition wsBinding, String baseURI, URI componentURI, URI bindingName) {
- URI wsdlURI = null;
- if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) {
- // <binding.ws> explicitly points at a wsdl port, may be a relative URI
- wsdlURI = wsBinding.getPortURI();
- }
- if (wsdlURI != null && wsdlURI.isAbsolute()) {
- if (wsBinding.getURI() != null && (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null)) {
- throw new IllegalArgumentException("binding URI cannot be used with absolute WSDL endpoint URI");
- }
- return URI.create(wsdlURI.toString());
- }
-
- // there is no wsdl port endpoint URI or that URI is relative
-
- URI bindingURI = null;
- if (wsBinding.getURI() != null) {
- bindingURI = URI.create(wsBinding.getURI());
- }
-
- if (bindingURI != null && bindingURI.isAbsolute()) {
- if (wsdlURI != null) {
- return URI.create(bindingURI + "/" + wsdlURI).normalize();
- } else {
- return bindingURI;
- }
- }
-
- if (componentURI == null) { // null for references
- wsdlURI = wsBinding.getPortURI();
- if (bindingURI != null) {
- return URI.create(wsdlURI + "/" + bindingURI).normalize();
- } else {
- return wsdlURI;
- }
- }
-
-
- // TODO: TUSCANY-xxx, how to tell if component has multiple services using <binding.ws>?
- // boolean singleService = (parent != null) && (((Component)parent.getChild(componentURI.toString())).getInboundWires().size() == 1);
- // if (bindingURI == null && !singleService) {
-
- if (bindingURI == null) {
- bindingURI = bindingName;
+ throw new RuntimeException(e); // TODO better exception
}
-
- if (componentURI.isAbsolute()) {
- if (bindingURI == null && wsdlURI == null) {
- return componentURI;
- } else if (wsdlURI == null) {
- return URI.create(componentURI + "/" + bindingURI).normalize();
- } else if (bindingURI == null) {
- return URI.create(componentURI + "/" + wsdlURI).normalize();
- } else {
- return URI.create(componentURI + "/" + bindingURI + "/" + wsdlURI).normalize();
- }
- }
-
- String actualURI = "";
-
- if (bindingURI == null) {
- actualURI = baseURI + "/" + componentURI + "/";
- } else {
- actualURI = baseURI + "/" + componentURI + "/" + bindingURI + "/";
- }
-
- if (wsdlURI != null) {
- actualURI = actualURI + wsdlURI.toString();
- }
-
- if (actualURI.endsWith("/")) {
- actualURI = actualURI.substring(0, actualURI.length() -1);
- }
-
- // normalize to handle any . or .. occurances
- return URI.create(actualURI).normalize();
}
+//
+// /**
+// * Compute the endpoint URI based on section 2.1.1 of the WS binding spec
+// * 1. The URIs in the endpoint(s) of the referenced WSDL, which may be relative
+// * 2. The URI specified by the wsa:Address element of the wsa:EndpointReference, which may be relative
+// * 3. The explicitly stated URI in the "uri" attribute of the binding.ws element, which may be relative,
+// * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec
+// * If the <binding.ws> has no wsdlElement but does have a uri attribute then the uri takes precidence
+// * over any implicitly used WSDL.
+// * @param parent
+// */
+// protected URI computeActualURI(WebServiceBindingDefinition wsBinding, String baseURI, URI componentURI, URI bindingName) {
+// URI wsdlURI = null;
+// if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) {
+// // <binding.ws> explicitly points at a wsdl port, may be a relative URI
+// wsdlURI = wsBinding.getPortURI();
+// }
+// if (wsdlURI != null && wsdlURI.isAbsolute()) {
+// if (wsBinding.getURI() != null && (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null)) {
+// throw new IllegalArgumentException("binding URI cannot be used with absolute WSDL endpoint URI");
+// }
+// return URI.create(wsdlURI.toString());
+// }
+//
+// // there is no wsdl port endpoint URI or that URI is relative
+//
+// URI bindingURI = null;
+// if (wsBinding.getURI() != null) {
+// bindingURI = URI.create(wsBinding.getURI());
+// }
+//
+// if (bindingURI != null && bindingURI.isAbsolute()) {
+// if (wsdlURI != null) {
+// return URI.create(bindingURI + "/" + wsdlURI).normalize();
+// } else {
+// return bindingURI;
+// }
+// }
+//
+// if (componentURI == null) { // null for references
+// wsdlURI = wsBinding.getPortURI();
+// if (bindingURI != null) {
+// return URI.create(wsdlURI + "/" + bindingURI).normalize();
+// } else {
+// return wsdlURI;
+// }
+// }
+//
+//
+// // TODO: TUSCANY-xxx, how to tell if component has multiple services using <binding.ws>?
+// // boolean singleService = (parent != null) && (((Component)parent.getChild(componentURI.toString())).getInboundWires().size() == 1);
+// // if (bindingURI == null && !singleService) {
+//
+// if (bindingURI == null) {
+// bindingURI = bindingName;
+// }
+//
+// if (componentURI.isAbsolute()) {
+// if (bindingURI == null && wsdlURI == null) {
+// return componentURI;
+// } else if (wsdlURI == null) {
+// return URI.create(componentURI + "/" + bindingURI).normalize();
+// } else if (bindingURI == null) {
+// return URI.create(componentURI + "/" + wsdlURI).normalize();
+// } else {
+// return URI.create(componentURI + "/" + bindingURI + "/" + wsdlURI).normalize();
+// }
+// }
+//
+// String actualURI = "";
+//
+// if (bindingURI == null) {
+// actualURI = baseURI + "/" + componentURI + "/";
+// } else {
+// actualURI = baseURI + "/" + componentURI + "/" + bindingURI + "/";
+// }
+//
+// if (wsdlURI != null) {
+// actualURI = actualURI + wsdlURI.toString();
+// }
+//
+// if (actualURI.endsWith("/")) {
+// actualURI = actualURI.substring(0, actualURI.length() -1);
+// }
+//
+// // normalize to handle any . or .. occurances
+// return URI.create(actualURI).normalize();
+// }
}
Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ModuleActivator.java?view=auto&rev=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ModuleActivator.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ModuleActivator.java Fri Apr 13 05:19:35 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.binding.axis2;
+
+import java.util.Map;
+
+import org.apache.tuscany.binding.ws.xml.WebServiceBindingProcessor;
+import org.apache.tuscany.services.spi.contribution.StAXArtifactProcessorRegistry;
+import org.apache.tuscany.spi.bootstrap.ExtensionPointRegistry;
+import org.apache.tuscany.spi.bootstrap.ModuleActivator;
+import org.apache.tuscany.spi.builder.BuilderRegistry;
+
+public class Axis2ModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+ StAXArtifactProcessorRegistry artifactProcessorRegistry = registry.getExtensionPoint(StAXArtifactProcessorRegistry.class);
+ artifactProcessorRegistry.addArtifactProcessor(new WebServiceBindingProcessor());
+
+ BuilderRegistry builderRegistry = registry.getExtensionPoint(BuilderRegistry.class);
+ Axis2BindingBuilder builder = new Axis2BindingBuilder();
+ builder.setBuilderRegistry(builderRegistry);
+ builder.init();
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+ public Map<Class, Object> getExtensionPoints() {
+ return null;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ModuleActivator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ModuleActivator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java?view=diff&rev=528453&r1=528452&r2=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceBinding.java Fri Apr 13 05:19:35 2007
@@ -38,12 +38,11 @@
import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData;
import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
+import org.apache.tuscany.binding.ws.WebServiceBinding;
+import org.apache.tuscany.interfacedef.Operation;
import org.apache.tuscany.spi.component.TargetInvokerCreationException;
import org.apache.tuscany.spi.component.WorkContext;
import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
import org.apache.tuscany.spi.wire.TargetInvoker;
/**
@@ -58,9 +57,9 @@
@SuppressWarnings("unchecked")
public Axis2ReferenceBinding(URI uri,
- WebServiceBindingDefinition wsBinding,
- ServiceContract contract,
- ServiceContract<?> bindingServiceContract,
+ WebServiceBinding wsBinding,
+// ServiceContract contract,
+// ServiceContract<?> bindingServiceContract,
WorkContext workContext) {
super(uri, uri); // TODO: what should these be
this.bindingServiceContract = bindingServiceContract;
Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java?view=diff&rev=528453&r1=528452&r2=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInMessageReceiver.java Fri Apr 13 05:19:35 2007
@@ -24,16 +24,16 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.receivers.AbstractInMessageReceiver;
-import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.interfacedef.Operation;
import org.apache.tuscany.spi.wire.InvocationRuntimeException;
public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver {
- protected Operation<?> operation;
+ protected Operation operation;
private Axis2ServiceBinding axis2Service;
- public Axis2ServiceInMessageReceiver(Axis2ServiceBinding service, Operation<?> operation) {
+ public Axis2ServiceInMessageReceiver(Axis2ServiceBinding service, Operation operation) {
this.axis2Service = service;
this.operation = operation;
}
@@ -49,19 +49,19 @@
Object[] args = new Object[] {requestOM};
String conversationID = axis2Service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null;
- axis2Service.invokeTarget(operation, args, null, conversationID);
+// axis2Service.invokeTarget(operation, args, null, conversationID);
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t instanceof Exception) {
- throw AxisFault.makeFault((Exception)t);
- }
- throw new InvocationRuntimeException(e);
+// } catch (InvocationTargetException e) {
+// Throwable t = e.getCause();
+// if (t instanceof Exception) {
+// throw AxisFault.makeFault((Exception)t);
+// }
+// throw new InvocationRuntimeException(e);
} catch (Throwable t) {
if (t instanceof Exception) {
throw AxisFault.makeFault((Exception)t);
}
- throw new Axis2BindingRunTimeException(t);
+ throw new RuntimeException(t);
}
}
Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java?view=diff&rev=528453&r1=528452&r2=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java Fri Apr 13 05:19:35 2007
@@ -26,13 +26,13 @@
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.receivers.AbstractMessageReceiver;
import org.apache.tuscany.binding.axis2.Axis2ServiceBinding.InvocationContext;
-import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.interfacedef.Operation;
import org.apache.tuscany.spi.wire.InvocationRuntimeException;
import org.apache.tuscany.spi.wire.MessageId;
public class Axis2ServiceInOutAsyncMessageReceiver extends AbstractMessageReceiver {
- private Operation<?> operation;
+ private Operation operation;
private Axis2ServiceBinding service;
@@ -55,9 +55,9 @@
// Now use message id as index to context to be used by callback
// target invoker
CountDownLatch doneSignal = new CountDownLatch(1);
- InvocationContext invCtx =
- service.new InvocationContext(messageCtx, operation, getSOAPFactory(messageCtx), doneSignal);
- service.addMapping(messageId, invCtx);
+// InvocationContext invCtx =
+// service.new InvocationContext(messageCtx, operation, getSOAPFactory(messageCtx), doneSignal);
+// service.addMapping(messageId, invCtx);
invokeBusinessLogic(messageCtx, messageId);
@@ -76,13 +76,13 @@
OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
Object[] args = new Object[] {requestOM};
String conversationID = service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null;
- service.invokeTarget(operation, args, messageId, conversationID);
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t instanceof Exception) {
- throw AxisFault.makeFault((Exception)t);
- }
- throw new InvocationRuntimeException(e);
+// service.invokeTarget(operation, args, messageId, conversationID);
+// } catch (InvocationTargetException e) {
+// Throwable t = e.getCause();
+// if (t instanceof Exception) {
+// throw AxisFault.makeFault((Exception)t);
+// }
+// throw new InvocationRuntimeException(e);
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java?view=diff&rev=528453&r1=528452&r2=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java Fri Apr 13 05:19:35 2007
@@ -26,16 +26,16 @@
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
-import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.interfacedef.Operation;
import org.apache.tuscany.spi.wire.InvocationRuntimeException;
public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver {
- protected Operation<?> operation;
+ protected Operation operation;
private Axis2ServiceBinding axis2Service;
- public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceBinding service, Operation<?> operation) {
+ public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceBinding service, Operation operation) {
this.axis2Service = service;
this.operation = operation;
}
@@ -52,7 +52,7 @@
String conversationID = axis2Service.isConversational() ? Axis2ServiceBinding.getConversationID(inMC) : null;
- OMElement responseOM = (OMElement)axis2Service.invokeTarget(operation, args, null, conversationID);
+ OMElement responseOM = null; //(OMElement)axis2Service.invokeTarget(operation, args, null, conversationID);
SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope();
@@ -62,13 +62,13 @@
outMC.setEnvelope(soapEnvelope);
outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- Throwable t = e.getCause();
- if (t instanceof Exception) {
- throw AxisFault.makeFault((Exception)t);
- }
- throw new InvocationRuntimeException(e);
+// } catch (InvocationTargetException e) {
+// e.printStackTrace();
+// Throwable t = e.getCause();
+// if (t instanceof Exception) {
+// throw AxisFault.makeFault((Exception)t);
+// }
+// throw new InvocationRuntimeException(e);
} catch (Exception e) {
e.printStackTrace();
throw AxisFault.makeFault(e);
Added: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2WSReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2WSReference.java?view=auto&rev=528453
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2WSReference.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2WSReference.java Fri Apr 13 05:19:35 2007
@@ -0,0 +1,125 @@
+/*
+ * 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.binding.axis2;
+
+import java.net.URI;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.tuscany.binding.axis2.util.TuscanyAxisConfigurator;
+import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData;
+import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
+import org.apache.tuscany.binding.ws.xml.WebServiceConstants;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.spi.component.TargetInvokerCreationException;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+public class Axis2WSReference extends ReferenceBindingExtension {
+
+ private WorkContext workContext;
+
+ public Axis2WSReference(URI name, URI targetUri) {
+ super(name, targetUri);
+ }
+
+ public QName getBindingType() {
+ return WebServiceConstants.BINDING_WS_QNAME;
+ }
+
+ public TargetInvoker createTargetInvoker(String targetName, Operation operation, boolean isCallback) throws TargetInvokerCreationException {
+ Options options = null;
+ SOAPFactory soapFactory = null;
+ QName wsdlOperationQName = null;
+ ServiceClient serviceClient = null;
+ Axis2TargetInvoker invoker = new Axis2TargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext);
+ return invoker;
+ }
+
+ /**
+ * Create an Axis2 ServiceClient
+ */
+ private ServiceClient createServiceClient(Definition wsdlDefinition, WebServicePortMetaData wsPortMetaData)
+ throws AxisFault {
+
+ TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+ ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
+ QName serviceQName = wsPortMetaData.getServiceName();
+ String portName = wsPortMetaData.getPortName().getLocalPart();
+ AxisService axisService =
+ AxisService.createClientSideAxisService(wsdlDefinition, serviceQName, portName, new Options());
+ return new ServiceClient(configurationContext, axisService);
+ }
+
+ /**
+ * Create and configure an Axis2TargetInvoker for each operations
+ */
+ private Axis2TargetInvoker createOperationInvoker(ServiceClient serviceClient,
+ Operation m,
+ WebServicePortMetaData wsPortMetaData,
+ boolean hasCallback,
+ boolean isOneWay) throws AxisFault {
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ String portTypeNS = wsPortMetaData.getPortTypeName().getNamespaceURI();
+
+ String methodName = m.getName();
+
+ WebServiceOperationMetaData operationMetaData = wsPortMetaData.getOperationMetaData(methodName);
+
+ Options options = new Options();
+ options.setTo(new EndpointReference(wsPortMetaData.getEndpoint()));
+ options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
+
+ String wsdlOperationName = operationMetaData.getBindingOperation().getOperation().getName();
+
+ String soapAction = wsPortMetaData.getOperationMetaData(wsdlOperationName).getSOAPAction();
+ if (soapAction != null && soapAction.length() > 1) {
+ options.setAction(soapAction);
+ }
+
+ options.setTimeOutInMilliSeconds(5 * 60 * 1000);
+
+ QName wsdlOperationQName = new QName(portTypeNS, wsdlOperationName);
+
+ Axis2TargetInvoker invoker;
+ if (hasCallback) {
+ invoker =
+ new Axis2AsyncTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext);
+ } else if (isOneWay) {
+ invoker =
+ new Axis2OneWayTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext);
+ } else {
+ invoker = new Axis2TargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, workContext);
+ }
+
+ return invoker;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2WSReference.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2WSReference.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org