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 2006/09/18 07:33:14 UTC
svn commit: r447254 [1/3] - in /incubator/tuscany/java:
samples/sca/echo.databinding/src/main/java/echo/ samples/sca/helloworldws/
samples/sca/helloworldws/src/main/java/helloworld/
samples/sca/helloworldws/src/main/resources/wsdl/ samples/sca/hellowor...
Author: rfeng
Date: Sun Sep 17 22:33:12 2006
New Revision: 447254
URL: http://svn.apache.org/viewvc?view=rev&rev=447254
Log:
Adjust the ServiceContract/Operation/DataType model to get effective databinding.
Remove the hard-dependency of SDO out of Axis2 binding code and fully integrate databinding framework, databinding-sdo and databinding-axiom with Axis2 binding
using interceptors and transformers.
Bring up the helloworldws and helloworldwsclient samples to use simple java types and SDO.
Added:
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.axiom.scdl
- copied unchanged from r443479, incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-databinding-axiom.scdl
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.scdl
- copied, changed from r443479, incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-databinding.scdl
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/interface.wsdl.scdl
- copied unchanged from r443479, incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-interface-wsdl.scdl
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl
incubator/tuscany/java/sca/databinding/databinding-jaxb/src/main/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandler.java (with props)
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2String.java (with props)
Removed:
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-databinding-axiom.scdl
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-databinding.scdl
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-interface-wsdl.scdl
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/util/SDODataBinding.java
Modified:
incubator/tuscany/java/samples/sca/echo.databinding/src/main/java/echo/EchoReference.java
incubator/tuscany/java/samples/sca/helloworldws/pom.xml
incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java
incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java
incubator/tuscany/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl
incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/sca/default.scdl
incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.scdl
incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl
incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/webapp.scdl
incubator/tuscany/java/samples/sca/helloworldwsclient/pom.xml
incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java
incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSClient.java
incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2TargetInvoker.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBinding.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/WebServiceBindingLoader.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
incubator/tuscany/java/sca/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/AxiomDataBinding.java
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/String2OMElement.java
incubator/tuscany/java/sca/databinding/databinding-axiom/src/main/java/org/apache/tuscany/databinding/axiom/XMLStreamReader2OMElement.java
incubator/tuscany/java/sca/databinding/databinding-axiom/src/test/java/org/apache/tuscany/databinding/axiom/OMElementWrapperTransformerTestCase.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/Mediator.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/TransformationContext.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Input2InputTransformer.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/idl/Output2OutputTransformer.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingInteceptor.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingJavaInterfaceProcessor.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingRegistryImpl.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/DataBindingWirePostProcessor.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/MediatorImpl.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/main/java/org/apache/tuscany/databinding/impl/TransformationContextImpl.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/test/java/org/apache/tuscany/databinding/impl/DataBindingInterceptorTestCase.java
incubator/tuscany/java/sca/databinding/databinding-framework/src/test/java/org/apache/tuscany/databinding/impl/MediatorImplTestCase.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2String.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/DataObject2XMLStreamReader.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDODataBinding.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/SDOWrapperHandler.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/String2DataObject.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLDocument2XMLStreamReader.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2DataObject.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/java/org/apache/tuscany/databinding/sdo/XMLStreamReader2XMLDocument.java
incubator/tuscany/java/sca/databinding/databinding-sdo/src/main/resources/META-INF/sca/default.scdl
incubator/tuscany/java/sca/databinding/databinding-test/src/test/java/org/apache/tuscany/databinding/TransformationTestCase.java
incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/InterfaceWSDLIntrospectorImpl.java
incubator/tuscany/java/sca/idl/wsdl/src/main/java/org/apache/tuscany/idl/wsdl/WSDLOperation.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/DataType.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/Operation.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/model/ServiceContract.java
Modified: incubator/tuscany/java/samples/sca/echo.databinding/src/main/java/echo/EchoReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/echo.databinding/src/main/java/echo/EchoReference.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/echo.databinding/src/main/java/echo/EchoReference.java (original)
+++ incubator/tuscany/java/samples/sca/echo.databinding/src/main/java/echo/EchoReference.java Sun Sep 17 22:33:12 2006
@@ -19,7 +19,6 @@
package echo;
import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.idl.wsdl.WSDLOperation;
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.extension.ReferenceExtension;
import org.apache.tuscany.spi.model.Operation;
@@ -42,10 +41,6 @@
public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
// HACK to set the databinding
operation.setDataBinding(OM_DATA_BINDING);
- WSDLOperation op = (WSDLOperation) operation.getMetaData().get(WSDLOperation.class.getName());
- if (op != null) {
- op.setDataBinding(OM_DATA_BINDING);
- }
return new EchoInvoker();
}
}
Modified: incubator/tuscany/java/samples/sca/helloworldws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/pom.xml?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/pom.xml Sun Sep 17 22:33:12 2006
@@ -42,6 +42,19 @@
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca.kernel</groupId>
+ <artifactId>tuscany-api</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope> <!-- runtime is need for webapp integration to include jar -->
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.0.1</artifactId>
+ <version>1.0-incubator-M2-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.kernel</groupId>
<artifactId>core</artifactId>
<version>${pom.version}</version>
<scope>runtime</scope> <!-- runtime is need for webapp integration to include jar -->
Modified: incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldImpl.java Sun Sep 17 22:33:12 2006
@@ -20,6 +20,8 @@
import org.osoa.sca.annotations.Service;
+import commonj.sdo.DataObject;
+
/**
* This class implements the HelloWorld service.
*/
@@ -28,6 +30,12 @@
public String getGreetings(String name) {
return "Hello " + name;
+ }
+
+ public String getGreetings1(DataObject name) {
+ String firstName = name.getString("firstName");
+ String lastName = name.getString("lastName");
+ return "Hello " + firstName + " " + lastName;
}
}
Modified: incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/src/main/java/helloworld/HelloWorldService.java Sun Sep 17 22:33:12 2006
@@ -18,11 +18,22 @@
*/
package helloworld;
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+import commonj.sdo.DataObject;
+
/**
* This is the business interface of the HelloWorld greetings service.
*/
+@Remotable
+@Service
public interface HelloWorldService {
public String getGreetings(String name);
+ @DataType(name="commonj.sdo.DataObject")
+ public String getGreetings1(DataObject name);
}
+
Modified: incubator/tuscany/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/src/main/resources/wsdl/helloworld.wsdl Sun Sep 17 22:33:12 2006
@@ -38,6 +38,31 @@
</sequence>
</complexType>
</element>
+
+ <element name="getGreetings1">
+ <complexType>
+ <sequence>
+ <element name="name" type="tns:NameType">
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="firstName" type="string"/>
+ <element name="lastName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="getGreetings1Response">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
</wsdl:types>
@@ -49,11 +74,23 @@
<wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
</wsdl:message>
+ <wsdl:message name="getGreetings1Request">
+ <wsdl:part element="tns:getGreetings1" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Response">
+ <wsdl:part element="tns:getGreetings1Response" name="parameters"/>
+ </wsdl:message>
+
<wsdl:portType name="HelloWorld">
<wsdl:operation name="getGreetings">
<wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
<wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
</wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdl:input message="tns:getGreetings1Request" name="getGreetings1Request"/>
+ <wsdl:output message="tns:getGreetings1Response" name="getGreetings1Response"/>
+ </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
@@ -67,11 +104,21 @@
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetings1Request">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetings1Response">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://localhost:8080/sample-helloworldws/services/HelloWorldWebService"/>
+ <wsdlsoap:address location="http://localhost:8080/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService"/>
</wsdl:port>
</wsdl:service>
Modified: incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/sca/default.scdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/sca/default.scdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/sca/default.scdl Sun Sep 17 22:33:12 2006
@@ -1,42 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * 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.
+ * 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.
-->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="helloworldws">
- <import.sdo location="wsdl/helloworld.wsdl"/>
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="helloworldws">
+
+ <import.sdo location="wsdl/helloworld.wsdl" />
- <service name="HelloWorldWebService" target="http:///foo">
- <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/ -->
- <interface.java interface="helloworld.HelloWorldService"/>
+ <service name="HelloWorldWebService" target="http:///foo">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+
+ <!--
+ <interface.java interface="helloworld.HelloWorldService" />
+ -->
-
-<!--FIXME the location attribute is a really bad hack here! does not follow to spec at all
--->
- <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
- conformanceURIs="http://ws-i.org/profiles/basic/1.1"
- location="wsdl/helloworld.wsdl"
- />
+ <!--FIXME the location attribute is a really bad hack here! does not follow to spec at all
+ -->
+ <binding.ws endpoint="http://helloworld#wsdl.endpoint(HelloWorldService/HelloWorldSoapPort)"
+ conformanceURIs="http://ws-i.org/profiles/basic/1.1" location="wsdl/helloworld.wsdl" />
<reference>HelloWorldServiceComponent</reference>
</service>
<component name="HelloWorldServiceComponent">
- <implementation.java class="helloworld.HelloWorldImpl"/>
+ <implementation.java class="helloworld.HelloWorldImpl" />
</component>
</composite>
Modified: incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.scdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.scdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.scdl Sun Sep 17 22:33:12 2006
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
*
@@ -13,13 +13,10 @@
* 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.
--->
+-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
name="org.apache.tuscany.databinding.Framework">
- <include name="org.apache.tuscany.databinding.Axiom" scdlLocation="databinding.axiom.scdl"/>
- <include name="org.apache.tuscany.databinding.SDO" scdlLocation="databinding.sdo.scdl"/>
-
<component name="databinding.wirePostProcessor">
<system:implementation.system class="org.apache.tuscany.databinding.impl.DataBindingWirePostProcessor"/>
</component>
Modified: incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/databinding.sdo.scdl Sun Sep 17 22:33:12 2006
@@ -20,7 +20,7 @@
<!--
import.sdo configuration
- $Rev: 432832 $ $Date: 2006-08-19 05:37:17 -0700 (Sat, 19 Aug 2006) $
+ $Rev: 431086 $ $Date: 2006-08-12 13:58:17 -0700 (Sat, 12 Aug 2006) $
-->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
@@ -29,6 +29,32 @@
<!-- import.sdo element loader implementations -->
<component name="elementLoader.import.sdo">
<system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
+ </component>
+
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
</component>
</composite>
Modified: incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/webapp.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/webapp.scdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/webapp.scdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldws/src/main/webapp/META-INF/tuscany/webapp.scdl Sun Sep 17 22:33:12 2006
@@ -132,7 +132,9 @@
<property name = "repository">.</property>
</component>
- <include name="databinding.framework" scdlLocation="databinding.scdl"/>
+ <include name="databinding" scdlLocation="databinding.scdl"/>
+ <include name="databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
<include name="binding.axis2" scdlLocation="binding.axis2.scdl"/>
<include name="interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/pom.xml?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/pom.xml Sun Sep 17 22:33:12 2006
@@ -33,6 +33,14 @@
</properties>
<dependencies>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.0.1</artifactId>
+ <version>${tuscanyVersion}</version>
+ <scope>compile</scope>
+ </dependency>
+
<dependency>
<groupId>org.apache.tuscany.sca.kernel</groupId>
<artifactId>core</artifactId>
@@ -59,7 +67,14 @@
<version>${tuscanyVersion}</version>
<scope>test</scope>
</dependency>
-
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${tuscanyVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java Sun Sep 17 22:33:12 2006
@@ -18,13 +18,18 @@
*/
package helloworld;
+import org.apache.tuscany.api.annotation.DataType;
import org.osoa.sca.annotations.Remotable;
import org.osoa.sca.annotations.Service;
+import commonj.sdo.DataObject;
+
@Remotable
@Service
public interface HelloWorldService {
public String getGreetings(String name);
+ @DataType(name="commonj.sdo.DataObject")
+ public String getGreetings1(DataObject name);
}
Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/java/helloworld/HelloWorldServiceComponent.java Sun Sep 17 22:33:12 2006
@@ -20,6 +20,8 @@
import org.osoa.sca.annotations.Scope;
+import commonj.sdo.DataObject;
+
/**
* This client program shows how to create an SCA runtime, start it,
@@ -43,5 +45,9 @@
public void setHelloWorldService(HelloWorldService helloWorldService) {
this.helloWorldService = helloWorldService;
+ }
+
+ public String getGreetings1(DataObject name) {
+ return helloWorldService.getGreetings1(name);
}
}
Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/main/resources/wsdl/helloworld.wsdl Sun Sep 17 22:33:12 2006
@@ -38,6 +38,31 @@
</sequence>
</complexType>
</element>
+
+ <element name="getGreetings1">
+ <complexType>
+ <sequence>
+ <element name="name" type="tns:NameType">
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+
+ <complexType name="NameType">
+ <sequence>
+ <element name="firstName" type="string"/>
+ <element name="lastName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="getGreetings1Response">
+ <complexType>
+ <sequence>
+ <element name="getGreetingsReturn" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
</schema>
</wsdl:types>
@@ -49,11 +74,23 @@
<wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
</wsdl:message>
+ <wsdl:message name="getGreetings1Request">
+ <wsdl:part element="tns:getGreetings1" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="getGreetings1Response">
+ <wsdl:part element="tns:getGreetings1Response" name="parameters"/>
+ </wsdl:message>
+
<wsdl:portType name="HelloWorld">
<wsdl:operation name="getGreetings">
<wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
<wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
</wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdl:input message="tns:getGreetings1Request" name="getGreetings1Request"/>
+ <wsdl:output message="tns:getGreetings1Response" name="getGreetings1Response"/>
+ </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
@@ -67,6 +104,16 @@
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
+ <wsdl:operation name="getGreetings1">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="getGreetings1Request">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getGreetings1Response">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
</wsdl:binding>
<wsdl:service name="HelloWorldService">
Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSClient.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSClient.java (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/java/helloworld/HelloWorldWSClient.java Sun Sep 17 22:33:12 2006
@@ -19,12 +19,20 @@
package helloworld;
+import java.net.URL;
+
import junit.framework.Assert;
import org.apache.tuscany.test.SCATestCase;
+import org.apache.xerces.impl.xs.traversers.XSDHandler;
import org.osoa.sca.CompositeContext;
import org.osoa.sca.CurrentCompositeContext;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.TypeHelper;
+import commonj.sdo.helper.XSDHelper;
+
/**
* Test case for helloworld web service client
*/
@@ -35,17 +43,22 @@
@Override
protected void setUp() throws Exception {
ClassLoader classLoader = getClass().getClassLoader();
- addExtension("idl.wsdl", classLoader.getResource("META-INF/tuscany/test-interface-wsdl.scdl"));
- addExtension("databinding", classLoader.getResource("META-INF/tuscany/test-databinding.scdl"));
- // FIXME: Adding extensions programtically
- addExtension("org.apache.tuscany.binding.axis2.WebServiceBinding", classLoader.getResource("META-INF/tuscany/binding.axis2.scdl"));
- addExtension("org.apache.tuscany.databinding.sdo", classLoader.getResource("META-INF/tuscany/databinding.sdo.scdl"));
+ addExtension("test.extensions", classLoader.getResource("META-INF/tuscany/test-extensions.scdl"));
super.setUp();
CompositeContext compositeContext = CurrentCompositeContext.getContext();
helloWorldService = compositeContext.locateService(HelloWorldService.class, "HelloWorldServiceComponent");
}
- public void testWSClient() {
+ public void testWSClient() throws Exception {
+ URL wsdl = getClass().getResource("/wsdl/helloworld.wsdl");
+ XSDHelper.INSTANCE.define(wsdl.openStream(), wsdl.toExternalForm());
+
+ DataObject name = DataFactory.INSTANCE.create("http://helloworld", "NameType");
+ name.setString("firstName", "John");
+ name.setString("lastName", "Smith");
+ String msg1 = helloWorldService.getGreetings1(name);
+ Assert.assertEquals("Hello John Smith", msg1);
+
String msg = helloWorldService.getGreetings("John");
Assert.assertEquals("Hello John", msg);
msg = helloWorldService.getGreetings("Smith");
Copied: incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.scdl (from r443479, incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-databinding.scdl)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.scdl?view=diff&rev=447254&p1=incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-databinding.scdl&r1=443479&p2=incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.scdl&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-databinding.scdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.scdl Sun Sep 17 22:33:12 2006
@@ -17,8 +17,6 @@
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
name="org.apache.tuscany.databinding.Framework">
- <include name="org.apache.tuscany.databinding.Axiom" scdlLocation="test-databinding-axiom.scdl"/>
-
<component name="databinding.wirePostProcessor">
<system:implementation.system class="org.apache.tuscany.databinding.impl.DataBindingWirePostProcessor"/>
</component>
Modified: incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.sdo.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.sdo.scdl?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.sdo.scdl (original)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/databinding.sdo.scdl Sun Sep 17 22:33:12 2006
@@ -30,5 +30,29 @@
<component name="elementLoader.import.sdo">
<system:implementation.system class="org.apache.tuscany.databinding.sdo.ImportSDOLoader"/>
</component>
+ <component name="databinding.sdo">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.SDODataBinding" />
+ </component>
+ <component name="transformer.DataObject2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2String"/>
+ </component>
+ <component name="transformer.DataObject2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.DataObject2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLDocument2String">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2String"/>
+ </component>
+ <component name="transformer.String2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.String2DataObject"/>
+ </component>
+ <component name="transformer.XMLDocument2XMLStreamReader">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLDocument2XMLStreamReader"/>
+ </component>
+ <component name="transformer.XMLStreamReader2DataObject">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2DataObject"/>
+ </component>
+ <component name="transformer.XMLStreamReader2XMLDocument">
+ <system:implementation.system class="org.apache.tuscany.databinding.sdo.XMLStreamReader2XMLDocument"/>
+ </component>
</composite>
Added: incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl?view=auto&rev=447254
==============================================================================
--- incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl (added)
+++ incubator/tuscany/java/samples/sca/helloworldwsclient/src/test/resources/META-INF/tuscany/test-extensions.scdl Sun Sep 17 22:33:12 2006
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="test.extensions">
+
+ <include name="org.apache.tuscany.databinding" scdlLocation="databinding.scdl"/>
+ <include name="org.apache.tuscany.databinding.axiom" scdlLocation="databinding.axiom.scdl"/>
+ <include name="org.apache.tuscany.databinding.sdo" scdlLocation="databinding.sdo.scdl"/>
+ <include name="org.apache.tuscany.interface.wsdl" scdlLocation="interface.wsdl.scdl"/>
+ <include name="org.apache.tuscany.binding.axis2" scdlLocation="binding.axis2.scdl"/>
+
+
+</composite>
\ No newline at end of file
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/pom.xml Sun Sep 17 22:33:12 2006
@@ -132,7 +132,7 @@
<!-- test dependencies -->
<dependency>
<groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
+ <artifactId>easymock</artifactId>
</dependency>
<dependency>
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2AsyncTargetInvoker.java Sun Sep 17 22:33:12 2006
@@ -19,13 +19,11 @@
import javax.xml.namespace.QName;
-import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
-import org.apache.tuscany.binding.axis2.util.SDODataBinding;
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.InvocationRuntimeException;
import org.apache.tuscany.spi.wire.Message;
@@ -42,21 +40,19 @@
public Axis2AsyncTargetInvoker(ServiceClient serviceClient,
QName wsdlOperationName,
Options options,
- SDODataBinding dataBinding,
SOAPFactory soapFactory,
InboundWire wire) {
- super(serviceClient, wsdlOperationName, options, dataBinding, soapFactory);
+ super(serviceClient, wsdlOperationName, options, soapFactory);
this.wire = wire;
}
public Object invokeTarget(final Object payload) throws InvocationTargetException {
try {
Object[] args = (Object[]) payload;
- boolean pureOMelement = (args != null && args.length > 0 && (args[0] instanceof OMElement));
OperationClient operationClient = createOperationClient(args);
callbackInvoker.setCorrelationId(messageId);
Axis2ReferenceCallback callback =
- new Axis2ReferenceCallback(callbackInvoker, getDataBinding(), pureOMelement);
+ new Axis2ReferenceCallback(callbackInvoker);
operationClient.setCallback(callback);
operationClient.execute(false);
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java Sun Sep 17 22:33:12 2006
@@ -18,9 +18,13 @@
*/
package org.apache.tuscany.binding.axis2;
+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.binding.axis2.util.TuscanyAxisConfigurator;
+import org.apache.tuscany.idl.wsdl.InterfaceWSDLIntrospector;
import org.apache.tuscany.spi.annotation.Autowire;
import org.apache.tuscany.spi.builder.BuilderConfigException;
import org.apache.tuscany.spi.component.CompositeComponent;
@@ -30,84 +34,118 @@
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.BoundReferenceDefinition;
import org.apache.tuscany.spi.model.BoundServiceDefinition;
-
-import commonj.sdo.helper.TypeHelper;
+import org.apache.tuscany.spi.model.ServiceContract;
/**
- * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.Reference} configured with the Axis2 binding
+ * Builds a {@link org.osoa.sca.annotations.Service} or {@link org.apache.tuscany.spi.component.Reference} configured
+ * with the Axis2 binding
*
* @version $Rev$ $Date$
*/
public class Axis2BindingBuilder extends BindingBuilderExtension<WebServiceBinding> {
+ private static final String OM_DATA_BINDING = OMElement.class.getName();
private ServletHost servletHost;
private ConfigurationContext configContext;
-
+
private WorkContext workContext;
+ private InterfaceWSDLIntrospector introspector;
+
public Axis2BindingBuilder() {
initAxis();
}
- @Autowire(required=false)
+ @Autowire(required = false)
public void setServletHost(ServletHost servletHost) {
this.servletHost = servletHost;
}
+ /**
+ * @param introspector the introspector to set
+ */
+ @Autowire
+ public void setIntrospector(InterfaceWSDLIntrospector introspector) {
+ this.introspector = introspector;
+ }
+
@Autowire
public void setWorkContext(WorkContext workContext) {
this.workContext = workContext;
}
@SuppressWarnings("unchecked")
- public Service build(CompositeComponent parent, BoundServiceDefinition<WebServiceBinding> serviceDefinition, DeploymentContext deploymentContext) {
+ public Service build(
+ CompositeComponent parent,
+ BoundServiceDefinition<WebServiceBinding> serviceDefinition,
+ DeploymentContext deploymentContext) {
- WebServiceBinding wsBinding = serviceDefinition.getBinding();
- Class<?> interfaze = serviceDefinition.getServiceContract().getInterfaceClass();
- TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName());
- if(typeHelper==null) typeHelper = TypeHelper.INSTANCE;
-
- return new Axis2Service(serviceDefinition.getName(),
- interfaze,
- parent,
- wireService,
- wsBinding,
- servletHost,
- configContext,
- typeHelper,
- workContext);
+ try {
+ // Set the default databinding
+ serviceDefinition.getServiceContract().setDataBinding(OM_DATA_BINDING);
+
+ // 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
+ // There are also cases that interface.java is used.
+
+ WebServiceBinding wsBinding = serviceDefinition.getBinding();
+ PortType portType = wsBinding.getWSDLPort().getBinding().getPortType();
+ ServiceContract<?> serviceContract = introspector.introspect(portType);
+
+ // FIXME:
+ serviceContract.setInterfaceClass(serviceDefinition.getServiceContract().getInterfaceClass());
+ serviceContract.setDataBinding(serviceDefinition.getServiceContract().getDataBinding());
+
+ return new Axis2Service(serviceDefinition.getName(), serviceContract, parent, wireService, wsBinding,
+ servletHost, configContext, workContext);
+ } catch (InvalidServiceContractException e) {
+ throw new Axis2BindingBuilderRuntimeException(e);
+ }
}
@SuppressWarnings("unchecked")
- public Reference build(CompositeComponent parent, BoundReferenceDefinition<WebServiceBinding> boundReferenceDefinition,
+ public Reference build(
+ CompositeComponent parent,
+ BoundReferenceDefinition<WebServiceBinding> boundReferenceDefinition,
DeploymentContext deploymentContext) {
-
- WebServiceBinding wsBinding = boundReferenceDefinition.getBinding();
- TypeHelper typeHelper = (TypeHelper) deploymentContext.getExtension(TypeHelper.class.getName());
- if(typeHelper==null) typeHelper = TypeHelper.INSTANCE;
-
- return new Axis2Reference(boundReferenceDefinition.getName(),
- parent,
- wireService,
- wsBinding,
- boundReferenceDefinition.getServiceContract(),
- typeHelper,
- workContext);
+
+ try {
+ // Set the default binding
+ boundReferenceDefinition.getServiceContract().setDataBinding(OM_DATA_BINDING);
+
+ // 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
+
+ WebServiceBinding wsBinding = boundReferenceDefinition.getBinding();
+ PortType portType = wsBinding.getWSDLPort().getBinding().getPortType();
+ ServiceContract<?> serviceContract = introspector.introspect(portType);
+
+ // Set the default databinding
+ serviceContract.setDataBinding(OM_DATA_BINDING);
+
+ return new Axis2Reference(boundReferenceDefinition.getName(), parent, wireService, wsBinding,
+ serviceContract, workContext);
+ } catch (InvalidServiceContractException e) {
+ throw new Axis2BindingBuilderRuntimeException(e);
+ }
}
protected Class<WebServiceBinding> getBindingType() {
return WebServiceBinding.class;
}
-
+
protected void initAxis() {
- // TODO: Fix classloader switching. See TUSCANY-647
+ // TODO: Fix classloader switching. See TUSCANY-647
// TODO: also consider having a system component wrapping the Axis2 ConfigContext
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
ClassLoader scl = getClass().getClassLoader();
- try {
+ try {
if (tccl != scl) {
Thread.currentThread().setContextClassLoader(scl);
}
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java Sun Sep 17 22:33:12 2006
@@ -20,22 +20,11 @@
import java.lang.reflect.Method;
-import java.util.List;
+
import javax.wsdl.Definition;
import javax.xml.namespace.QName;
-import org.apache.tuscany.spi.component.CompositeComponent;
-import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.extension.ReferenceExtension;
-import org.apache.tuscany.spi.model.Operation;
-import org.apache.tuscany.spi.model.ServiceContract;
-import org.apache.tuscany.spi.wire.OutboundWire;
-import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireService;
-
-import commonj.sdo.helper.TypeHelper;
import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
@@ -44,22 +33,26 @@
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.SDODataBinding;
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.idl.wsdl.WSDLOperation;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ReferenceExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+import org.apache.tuscany.spi.wire.WireService;
/**
* Axis2Reference uses Axis2 to invoke a remote web service
*/
public class Axis2Reference<T> extends ReferenceExtension {
- private static final String OM_DATA_BINDING = OMElement.class.getName();
private WebServicePortMetaData wsPortMetaData;
private ServiceClient serviceClient;
- private TypeHelper typeHelper;
private WorkContext workContext;
@SuppressWarnings("unchecked")
@@ -68,7 +61,6 @@
WireService wireService,
WebServiceBinding wsBinding,
ServiceContract contract,
- TypeHelper typeHelper,
WorkContext workContext) {
super(theName, (Class<T>) contract.getInterfaceClass(), parent, wireService);
try {
@@ -76,28 +68,18 @@
wsPortMetaData =
new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false);
serviceClient = createServiceClient(wsdlDefinition, wsPortMetaData);
- this.typeHelper = typeHelper;
this.workContext = workContext;
} catch (AxisFault e) {
- e.printStackTrace();
- throw new RuntimeException(e);
+ throw new Axis2BindingRunTimeException(e);
}
}
public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
Axis2TargetInvoker invoker;
try {
- //FIXME: SDODataBinding needs to pass in TypeHelper and classLoader as parameters.
- invoker = createOperationInvoker(serviceClient, operation, typeHelper, wsPortMetaData, false);
- // HACK to set the databinding
- operation.setDataBinding(OM_DATA_BINDING);
- WSDLOperation op = (WSDLOperation) operation.getMetaData().get(WSDLOperation.class.getName());
- if (op != null) {
- op.setDataBinding(OM_DATA_BINDING);
- }
+ invoker = createOperationInvoker(serviceClient, operation, wsPortMetaData, false);
} catch (AxisFault e) {
- e.printStackTrace();
- throw new RuntimeException(e);
+ throw new Axis2BindingRunTimeException(e);
}
return invoker;
}
@@ -107,7 +89,7 @@
try {
//FIXME: SDODataBinding needs to pass in TypeHelper and classLoader as parameters.
invoker =
- (Axis2AsyncTargetInvoker)createOperationInvoker(serviceClient, operation, typeHelper, wsPortMetaData, true);
+ (Axis2AsyncTargetInvoker)createOperationInvoker(serviceClient, operation, wsPortMetaData, true);
//FIXME: This makes the (BIG) assumption that there is only one callback method
// Relaxing this assumption, however, does not seem to be trivial, it may depend on knowledge
// of what actual callback method was invoked by the service at the other end
@@ -120,8 +102,7 @@
workContext);
invoker.setCallbackTargetInvoker(callbackInvoker);
} catch (AxisFault e) {
- e.printStackTrace();
- throw new RuntimeException(e);
+ throw new Axis2BindingRunTimeException(e);
}
return invoker;
}
@@ -150,7 +131,6 @@
*/
private Axis2TargetInvoker createOperationInvoker(ServiceClient serviceClient,
Operation m,
- TypeHelper typeHelper,
WebServicePortMetaData wsPortMetaData,
boolean isAsync)
throws AxisFault {
@@ -160,11 +140,6 @@
String methodName = m.getName();
WebServiceOperationMetaData operationMetaData = wsPortMetaData.getOperationMetaData(methodName);
- boolean isWrapped = operationMetaData.isDocLitWrapped();
- List<?> sig = operationMetaData.getOperationSignature();
-
- SDODataBinding dataBinding =
- new SDODataBinding(typeHelper, isWrapped, sig.size() > 0 ? (QName) sig.get(0) : null);
Options options = new Options();
options.setTo(new EndpointReference(wsPortMetaData.getEndpoint()));
@@ -181,9 +156,9 @@
Axis2TargetInvoker invoker;
if (isAsync) {
- invoker = new Axis2AsyncTargetInvoker(serviceClient, wsdlOperationQName, options, dataBinding, soapFactory, inboundWire);
+ invoker = new Axis2AsyncTargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory, inboundWire);
} else {
- invoker = new Axis2TargetInvoker(serviceClient, wsdlOperationQName, options, dataBinding, soapFactory);
+ invoker = new Axis2TargetInvoker(serviceClient, wsdlOperationQName, options, soapFactory);
}
return invoker;
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ReferenceCallback.java Sun Sep 17 22:33:12 2006
@@ -21,44 +21,20 @@
import org.apache.axis2.client.async.AsyncResult;
import org.apache.axis2.client.async.Callback;
import org.apache.axis2.context.MessageContext;
-import org.apache.tuscany.binding.axis2.util.SDODataBinding;
public class Axis2ReferenceCallback extends Callback {
private Axis2ReferenceCallbackTargetInvoker targetInvoker;
- private SDODataBinding dataBinding;
- private boolean pureOMelement;
- public Axis2ReferenceCallback(Axis2ReferenceCallbackTargetInvoker targetInvoker,
- SDODataBinding dataBinding,
- boolean pureOMelement) {
+ public Axis2ReferenceCallback(Axis2ReferenceCallbackTargetInvoker targetInvoker) {
this.targetInvoker = targetInvoker;
- this.dataBinding = dataBinding;
- this.pureOMelement = pureOMelement;
}
public void onComplete(AsyncResult result) {
MessageContext responseMC = result.getResponseMessageContext();
OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement();
-
- Object[] os = null;
- if (responseOM != null) {
- os = dataBinding.fromOMElement(responseOM);
- }
-
- Object response;
- if (pureOMelement) {
- response = responseOM;
- } else {
- if (os == null || os.length < 1) {
- response = null;
- } else {
- response = os[0];
- }
- }
-
try {
- targetInvoker.invokeTarget(response);
+ targetInvoker.invokeTarget(new Object[] {responseOM});
} catch(InvocationTargetException e) {
// FIXME what is the appropriate exception here?
throw new RuntimeException(e);
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java Sun Sep 17 22:33:12 2006
@@ -18,13 +18,13 @@
*/
package org.apache.tuscany.binding.axis2;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import javax.wsdl.Definition;
import javax.wsdl.Operation;
-import javax.wsdl.Part;
import javax.wsdl.PortType;
import javax.xml.namespace.QName;
@@ -40,8 +40,6 @@
import org.apache.axis2.engine.MessageReceiver;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.wsdl.WSDLConstants.WSDL20_2004Constants;
-import org.apache.tuscany.binding.axis2.util.SDODataBinding;
-import org.apache.tuscany.binding.axis2.util.WebServiceOperationMetaData;
import org.apache.tuscany.binding.axis2.util.WebServicePortMetaData;
import org.apache.tuscany.spi.builder.BuilderConfigException;
import org.apache.tuscany.spi.component.CompositeComponent;
@@ -49,41 +47,43 @@
import org.apache.tuscany.spi.extension.ServiceExtension;
import org.apache.tuscany.spi.host.ServletHost;
import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Message;
import org.apache.tuscany.spi.wire.MessageId;
+import org.apache.tuscany.spi.wire.MessageImpl;
import org.apache.tuscany.spi.wire.TargetInvoker;
import org.apache.tuscany.spi.wire.WireService;
import org.osoa.sca.annotations.Destroy;
-import commonj.sdo.helper.TypeHelper;
-
/**
* An implementation of a {@link ServiceExtension} configured with the Axis2 binding
*
* @version $Rev$ $Date$
*/
public class Axis2Service extends ServiceExtension {
+ private ServiceContract<?> serviceContract;
private ServletHost servletHost;
private ConfigurationContext configContext;
private WebServiceBinding binding;
-
- private TypeHelper typeHelper;
private WorkContext workContext;
-
+
private Map<MessageId, InvocationContext> invCtxMap = new HashMap<MessageId, InvocationContext>();
- public Axis2Service(String theName, Class<?> interfaze, CompositeComponent parent, WireService wireService, WebServiceBinding binding,
- ServletHost servletHost, ConfigurationContext configContext, TypeHelper typeHelper, WorkContext workContext) {
+ public Axis2Service(String theName, ServiceContract<?> serviceContract, CompositeComponent parent,
+ WireService wireService, WebServiceBinding binding, ServletHost servletHost,
+ ConfigurationContext configContext, WorkContext workContext) {
- super(theName, interfaze, parent, wireService);
+ super(theName, serviceContract.getInterfaceClass(), parent, wireService);
+ this.serviceContract = serviceContract;
this.binding = binding;
this.servletHost = servletHost;
this.configContext = configContext;
- this.typeHelper = typeHelper;
this.workContext = workContext;
}
@@ -115,10 +115,13 @@
private AxisService createAxisService(WebServiceBinding wsBinding) throws AxisFault {
Definition definition = wsBinding.getWSDLDefinition();
- WebServicePortMetaData wsdlPortInfo = new WebServicePortMetaData(definition, wsBinding.getWSDLPort(), null, false);
+ WebServicePortMetaData wsdlPortInfo =
+ new WebServicePortMetaData(definition, wsBinding.getWSDLPort(), null, false);
// TODO investigate if this is 20 wsdl what todo?
- WSDLToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(definition, wsdlPortInfo.getServiceName(), wsdlPortInfo.getPort().getName());
+ WSDLToAxisServiceBuilder builder =
+ new WSDL11ToAxisServiceBuilder(definition, wsdlPortInfo.getServiceName(), wsdlPortInfo.getPort()
+ .getName());
builder.setServerSide(true);
AxisService axisService = builder.populateService();
@@ -130,33 +133,21 @@
wsdlParam.setValue(definition);
axisService.addParameter(wsdlParam);
Parameter userWSDL = new Parameter("useOriginalwsdl", "true");
- axisService.addParameter(userWSDL );
-
- Class<?> serviceInterface = this.getInterface();
+ axisService.addParameter(userWSDL);
PortType wsdlPortType = wsdlPortInfo.getPortType();
for (Object o : wsdlPortType.getOperations()) {
Operation wsdlOperation = (Operation) o;
String operationName = wsdlOperation.getName();
QName operationQN = new QName(definition.getTargetNamespace(), operationName);
- Object entryPointProxy = this.getServiceInstance();
- WebServiceOperationMetaData omd = wsdlPortInfo.getOperationMetaData(operationName);
- QName responseQN = null;
- Part outputPart = omd.getOutputPart(0);
- if (outputPart != null) {
- responseQN = outputPart.getElementName();
- }
+ org.apache.tuscany.spi.model.Operation<?> op = serviceContract.getOperations().get(operationName);
- Method operationMethod = getMethod(serviceInterface, operationName);
- // outElementQName is not needed when calling fromOMElement method, and we can not get elementQName for
- // oneway operation.
- SDODataBinding dataBinding = new SDODataBinding(typeHelper, omd.isDocLitWrapped(), responseQN);
MessageReceiver msgrec = null;
if (inboundWire.getCallbackReferenceName() != null) {
- msgrec = new Axis2ServiceInOutAsyncMessageReceiver(entryPointProxy, operationMethod, dataBinding, this, workContext);
+ msgrec = new Axis2ServiceInOutAsyncMessageReceiver(this, op, workContext);
} else {
- msgrec = new Axis2ServiceInOutSyncMessageReceiver(entryPointProxy, operationMethod, dataBinding);
+ msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op);
}
AxisOperation axisOp = axisService.getOperation(operationQN);
@@ -167,6 +158,46 @@
return axisService;
}
+ public Object invokeTarget(org.apache.tuscany.spi.model.Operation<?> op, Object[] args)
+ throws InvocationTargetException {
+ InvocationChain chain = inboundWire.getInvocationChains().get(op);
+ Interceptor headInterceptor = chain.getHeadInterceptor();
+ if (headInterceptor == null) {
+ try {
+ // short-circuit the dispatch and invoke the target directly
+ if (chain.getTargetInvoker() == null) {
+ throw new AssertionError("No target invoker [" + chain.getOperation().getName() + "]");
+ }
+ return chain.getTargetInvoker().invokeTarget(args);
+ } catch (InvocationTargetException e) {
+ // the cause was thrown by the target so throw it
+ throw e;
+ }
+ } else {
+ Object messageId = workContext.getCurrentMessageId();
+ workContext.setCurrentMessageId(null);
+ Object correlationId = workContext.getCurrentCorrelationId();
+ workContext.setCurrentCorrelationId(null);
+
+ Message msg = new MessageImpl();
+ msg.setTargetInvoker(chain.getTargetInvoker());
+ if (messageId == null) {
+ messageId = new MessageId();
+ }
+ msg.setMessageId(messageId);
+ msg.setCorrelationId(correlationId);
+ msg.setBody(args);
+ Message resp;
+ // dispatch the wire down the chain and get the response
+ resp = headInterceptor.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw new InvocationTargetException((Throwable) body);
+ }
+ return body;
+ }
+ }
+
/**
* Get the Method from an interface matching the WSDL operation name
*/
@@ -184,40 +215,40 @@
return m;
}
}
- throw new BuilderConfigException("no operation named " + operationName + " found on service interface: " + serviceInterface.getName());
+ throw new BuilderConfigException("no operation named " + operationName + " found on service interface: "
+ + serviceInterface.getName());
}
- TypeHelper getTypeHelper() {
- return typeHelper;
- }
-
- public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, org.apache.tuscany.spi.model.Operation operation) {
+ public TargetInvoker createCallbackTargetInvoker(
+ ServiceContract contract,
+ org.apache.tuscany.spi.model.Operation operation) {
return new Axis2ServiceCallbackTargetInvoker(workContext, this);
}
-
+
public void addMapping(MessageId msgId, InvocationContext invCtx) {
this.invCtxMap.put(msgId, invCtx);
}
-
+
public InvocationContext retrieveMapping(MessageId msgId) {
return this.invCtxMap.get(msgId);
}
-
+
public void removeMapping(MessageId msgId) {
this.invCtxMap.remove(msgId);
}
-
+
protected class InvocationContext {
public MessageContext inMessageContext;
- public Method operationMethod;
- public SDODataBinding dataBinding;
+
+ public org.apache.tuscany.spi.model.Operation<?> operation;
+
public SOAPFactory soapFactory;
-
- public InvocationContext(MessageContext messageCtx, Method operationMethod, SDODataBinding dataBinding, SOAPFactory soapFactory) {
+
+ public InvocationContext(MessageContext messageCtx, org.apache.tuscany.spi.model.Operation<?> operation,
+ SOAPFactory soapFactory) {
this.inMessageContext = messageCtx;
- this.operationMethod = operationMethod;
- this.dataBinding = dataBinding;
+ this.operation = operation;
this.soapFactory = soapFactory;
}
}
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceCallbackTargetInvoker.java Sun Sep 17 22:33:12 2006
@@ -51,16 +51,7 @@
MessageContext outMC = Utils.createOutMessageContext(invCtx.inMessageContext);
outMC.getOperationContext().addMessageContext(invCtx.inMessageContext); // REVIEW was adding newmsgCtx !
- OMElement responseOM = null;
- Class<?>[] parameterTypes = invCtx.operationMethod.getParameterTypes();
- // Try to guess if it's passing OMElements
- if(parameterTypes.length>0 && OMElement.class.isAssignableFrom(parameterTypes[0])) {
- responseOM = (OMElement) payload;
- } else {
- // Assumming it's SDO then
- responseOM = invCtx.dataBinding.toOMElement(new Object[] {payload} );
- }
-
+ OMElement responseOM = (OMElement) payload;
SOAPEnvelope soapEnvelope = invCtx.soapFactory.getDefaultEnvelope();
soapEnvelope.getBody().addChild(responseOM);
outMC.setEnvelope(soapEnvelope);
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java Sun Sep 17 22:33:12 2006
@@ -18,44 +18,36 @@
*/
package org.apache.tuscany.binding.axis2;
-import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
-//import org.apache.axis2.receivers.AbstractInOutAsyncMessageReceiver;
import org.apache.axis2.receivers.AbstractMessageReceiver;
-//import org.apache.commons.logging.Log;
-//import org.apache.commons.logging.LogFactory;
import org.apache.tuscany.binding.axis2.Axis2Service.InvocationContext;
-import org.apache.tuscany.binding.axis2.util.SDODataBinding;
import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.wire.InvocationRuntimeException;
import org.apache.tuscany.spi.wire.MessageId;
public class Axis2ServiceInOutAsyncMessageReceiver extends AbstractMessageReceiver {
- // private static final Log log = LogFactory.getLog(AbstractInOutAsyncMessageReceiver.class);
- protected Method operationMethod;
- protected SDODataBinding dataBinding;
- private Object entryPointProxy;
+ private Operation<?> operation;
+
private WorkContext workContext;
+
private Axis2Service service;
- public Axis2ServiceInOutAsyncMessageReceiver(Object entryPointProxy,
- Method operationMethod,
- SDODataBinding dataBinding,
- Axis2Service service,
- WorkContext workContext) {
- this.entryPointProxy = entryPointProxy;
- this.operationMethod = operationMethod;
- this.dataBinding = dataBinding;
+ public Axis2ServiceInOutAsyncMessageReceiver(Axis2Service service, Operation operation,
+
+ WorkContext workContext) {
+ this.operation = operation;
this.workContext = workContext;
this.service = service;
}
public final void receive(final MessageContext messageCtx) {
-
+
Runnable theadedTask = new Runnable() {
public void run() {
try {
@@ -65,9 +57,9 @@
workContext.setCurrentMessageId(messageId);
// Now use message id as index to context to be used by callback target invoker
InvocationContext invCtx =
- service.new InvocationContext(messageCtx, operationMethod, dataBinding, getSOAPFactory(messageCtx));
+ service.new InvocationContext(messageCtx, operation, getSOAPFactory(messageCtx));
service.addMapping(messageId, invCtx);
-
+
invokeBusinessLogic(messageCtx);
} catch (AxisFault e) {
// log.error(e);
@@ -78,25 +70,17 @@
}
public void invokeBusinessLogic(MessageContext inMC) throws AxisFault {
-
- try {
+ try {
OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
- Class<?>[] parameterTypes = operationMethod.getParameterTypes();
- // Try to guess if it's passing OMElements
- if(parameterTypes.length>0 && OMElement.class.isAssignableFrom(parameterTypes[0])) {
- operationMethod.invoke(entryPointProxy, requestOM);
- } else {
- // Assumming it's SDO then
- Object[] args = dataBinding.fromOMElement(requestOM);
- operationMethod.invoke(entryPointProxy, args);
- }
- } catch (InvocationRuntimeException e) {
+ Object[] args = new Object[] { requestOM };
+ service.invokeTarget(operation, args);
+ } catch (InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof Exception) {
throw AxisFault.makeFault((Exception) t);
}
- throw e;
+ throw new InvocationRuntimeException(e);
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java Sun Sep 17 22:33:12 2006
@@ -18,8 +18,7 @@
*/
package org.apache.tuscany.binding.axis2;
-
-import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -27,53 +26,39 @@
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
-import org.apache.tuscany.binding.axis2.util.SDODataBinding;
+import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.wire.InvocationRuntimeException;
public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver {
- protected Method operationMethod;
- protected SDODataBinding dataBinding;
- // protected ClassLoader classLoader;
- private Object entryPointProxy;
-
- public Axis2ServiceInOutSyncMessageReceiver(Object entryPointProxy,
- Method operationMethod,
- SDODataBinding dataBinding) {
- this.entryPointProxy = entryPointProxy;
- this.operationMethod = operationMethod;
- this.dataBinding = dataBinding;
- // this.classLoader = classLoader;
+ protected Operation<?> operation;
+
+ private Axis2Service axis2Service;
+
+ public Axis2ServiceInOutSyncMessageReceiver(Axis2Service service, Operation<?> operation) {
+ this.axis2Service = service;
+ this.operation = operation;
}
@Override
public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault {
try {
-
OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
- OMElement responseOM = null;
- Class<?>[] parameterTypes = operationMethod.getParameterTypes();
- // Try to guess if it's passing OMElements
- if(parameterTypes.length>0 && OMElement.class.isAssignableFrom(parameterTypes[0])) {
- responseOM = (OMElement) operationMethod.invoke(entryPointProxy, requestOM);
- } else {
- // Assumming it's SDO then
- Object[] args = dataBinding.fromOMElement(requestOM);
- Object result = operationMethod.invoke(entryPointProxy,args);
- responseOM = dataBinding.toOMElement(new Object[] {result} );
- }
+ Object[] args = new Object[] { requestOM };
+
+ OMElement responseOM = (OMElement) axis2Service.invokeTarget(operation, args);
SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope();
soapEnvelope.getBody().addChild(responseOM);
outMC.setEnvelope(soapEnvelope);
outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
- } catch (InvocationRuntimeException e) {
+ } catch (InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof Exception) {
throw AxisFault.makeFault((Exception) t);
}
- throw e;
+ throw new InvocationRuntimeException(e);
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
Modified: incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java?view=diff&rev=447254&r1=447253&r2=447254
==============================================================================
--- incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java (original)
+++ incubator/tuscany/java/sca/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2ServiceServlet.java Sun Sep 17 22:33:12 2006
@@ -22,6 +22,7 @@
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Set;
import java.util.Vector;
@@ -82,7 +83,7 @@
public ServletContext getServletContext() {
return new ServletContext() {
- public ServletContext getContext(String arg0) {
+ public ServletContext getContext(String uripath) {
return null;
}
@@ -94,23 +95,23 @@
return 0;
}
- public String getMimeType(String arg0) {
+ public String getMimeType(String file) {
return null;
}
- public Set getResourcePaths(String arg0) {
- return null;
+ public Set getResourcePaths(String path) {
+ return Collections.emptySet();
}
- public URL getResource(String arg0) throws MalformedURLException {
+ public URL getResource(String path) throws MalformedURLException {
return null;
}
- public InputStream getResourceAsStream(String arg0) {
+ public InputStream getResourceAsStream(String path) {
return null;
}
- public RequestDispatcher getRequestDispatcher(String arg0) {
+ public RequestDispatcher getRequestDispatcher(String path) {
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org