tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramku...@apache.org
Subject svn commit: r711780 - in /tuscany/java/sca/modules/binding-ws-axis2/src: main/java/org/apache/tuscany/sca/binding/ws/axis2/ main/resources/org/apache/tuscany/sca/binding/ws/axis2/ test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/ test/reso...
Date Thu, 06 Nov 2008 07:12:19 GMT
Author: ramkumar
Date: Wed Nov  5 23:12:18 2008
New Revision: 711780

URL: http://svn.apache.org/viewvc?rev=711780&view=rev
Log:
Fixes for TUSCANY-2611

Added:
    tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/
    tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java
    tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java
    tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java
    tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java
    tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/
    tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl
    tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite
Modified:
    tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml

Modified: tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=711780&r1=711779&r2=711780&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
(original)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
Wed Nov  5 23:12:18 2008
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.binding.ws.axis2;
 
+import static org.apache.tuscany.sca.binding.ws.axis2.AxisPolicyHelper.isIntentRequired;
+
 import java.lang.reflect.InvocationTargetException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -50,6 +52,7 @@
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.Constants.Configuration;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -195,7 +198,13 @@
         } 
 
         configContext.setContextRoot(servletHost.getContextPath());
-
+        
+        // Enable MTOM if the policy intent is specified.
+        if (AxisPolicyHelper.isIntentRequired(wsBinding, AxisPolicyHelper.MTOM_INTENT)) {
+            configContext.getAxisConfiguration().getParameter(Configuration.ENABLE_MTOM).setLocked(false);
+            configContext.getAxisConfiguration().getParameter(Configuration.ENABLE_MTOM).setValue("true");
           
+        }
+        
         // Update port addresses with runtime information, and create a
         // map from endpoint URIs to WSDL ports that eliminates duplicate
         // ports for the same endpoint.

Modified: tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml?rev=711780&r1=711779&r2=711780&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml
(original)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml
Wed Nov  5 23:12:18 2008
@@ -25,7 +25,7 @@
             xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
             xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
             
-    <sca:bindingType type="sca:binding.ws"  mayProvide="SOAP SOAP.1_1 SOAP.1_2" alwaysProvides=""/>
+    <sca:bindingType type="sca:binding.ws"  mayProvide="SOAP SOAP.1_1 SOAP.1_2 MTOM" alwaysProvides=""/>
 
     <!-- PolicyIntents defined by the SCA Runtime Extension for WS Binding Axis 2 -->
     <sca:intent name="SOAP" constrains="sca:binding.ws">

Added: tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java?rev=711780&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java
(added)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java
Wed Nov  5 23:12:18 2008
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.sca.binding.ws.axis2.itests.mtom;
+
+import javax.activation.DataHandler;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the FileTransfer service and invoke it.
+ */
+public class FileTransferClient implements FileTransferService {
+    
+    @Reference
+    public FileTransferService fileTransferWS;
+
+    public String uploadFile(DataHandler attachment) throws Exception {        
+        return fileTransferWS.uploadFile(attachment);
+    }
+}

Added: tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java?rev=711780&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java
(added)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java
Wed Nov  5 23:12:18 2008
@@ -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.sca.binding.ws.axis2.itests.mtom;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import junit.framework.TestCase;
+import org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class FileTransferMTOMTestCase extends TestCase {
+
+    private SCADomain domain;
+
+    public void testFileTransfer() throws Exception {
+        // For testing purpose lets try uploading FileTransferClient.java file.
+        DataHandler dataHandler = new DataHandler(new FileDataSource("FileTransferClient.java"));
+        FileTransferService filetransfer = domain.getService(FileTransferService.class, "FileTransferServiceComponent");
+        assertEquals("File uploaded Sucessfully", filetransfer.uploadFile(dataHandler));
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite");
+    }
+   
+    @Override
+    protected void tearDown() throws Exception {
+        domain.close();
+    }
+
+}

Added: tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java?rev=711780&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java
(added)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java
Wed Nov  5 23:12:18 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.sca.binding.ws.axis2.itests.mtom;
+
+import org.osoa.sca.annotations.Remotable;
+import javax.activation.DataHandler;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+public interface FileTransferService {
+
+    public String uploadFile(DataHandler attachment) throws Exception;
+}
+

Added: tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java?rev=711780&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java
(added)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java
Wed Nov  5 23:12:18 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.sca.binding.ws.axis2.itests.mtom;
+
+import org.osoa.sca.annotations.Service;
+import javax.activation.DataHandler;
+import java.io.File;
+import java.io.FileOutputStream;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(FileTransferService.class)
+public class FileTransferServiceImpl implements FileTransferService {
+
+    public String uploadFile(DataHandler attachment) throws Exception {
+        
+        //OMText binaryNode = (OMText) (attachment.getFirstElement()).getFirstOMChild();
+        //DataHandler dataHandler = (DataHandler) binaryNode.getDataHandler();        
+        
+        // Use this code to save the file we have received.
+        /*DataHandler dataHandler = attachment;
+        
+        File file = new File("transferedfile.java");
+        FileOutputStream fileOutputStream = new FileOutputStream(file);
+        dataHandler.writeTo(fileOutputStream);        
+        fileOutputStream.flush();
+        fileOutputStream.close();*/
+        
+        System.out.println(attachment.getContentType());
+        
+        return "File uploaded Sucessfully";
+    }
+
+}

Added: tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl?rev=711780&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl
(added)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl
Wed Nov  5 23:12:18 2008
@@ -0,0 +1,84 @@
+<?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.    
+-->
+<wsdl:definitions 
+    targetNamespace="http://filetransfer" 
+    xmlns:tns="http://filetransfer" 
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
+    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	name="filetransfer">
+
+    <wsdl:types>
+        <schema elementFormDefault="qualified" targetNamespace="http://filetransfer" xmlns="http://www.w3.org/2001/XMLSchema">
+
+            <element name="uploadFile">
+                <complexType>
+                    <sequence>
+                        <element name="attachment" type="xsd:base64Binary"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="uploadFileResponse">
+                <complexType>
+                    <sequence>
+                        <element name="uploadFileReturn" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            
+        </schema>
+    </wsdl:types>
+
+    <wsdl:message name="uploadFileRequest">
+        <wsdl:part element="tns:uploadFile" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:message name="uploadFileResponse">
+        <wsdl:part element="tns:uploadFileResponse" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:portType name="FileTransfer">
+        <wsdl:operation name="uploadFile">
+            <wsdl:input message="tns:uploadFileRequest" name="uploadFileRequest"/>
+            <wsdl:output message="tns:uploadFileResponse" name="uploadFileResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="FileTransferSoapBinding" type="tns:FileTransfer">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="uploadFile">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="uploadFileRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="uploadFileResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="FileTransferService">
+        <wsdl:port binding="tns:FileTransferSoapBinding" name="FileTransferSoapPort">
+            <wsdlsoap:address location="http://localhost:8085/FileTransferServiceComponent"/>
+        </wsdl:port>
+    </wsdl:service>
+
+</wsdl:definitions>

Added: tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite?rev=711780&view=auto
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite
(added)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite
Wed Nov  5 23:12:18 2008
@@ -0,0 +1,42 @@
+<?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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	targetNamespace="http://filetransfer"
+	xmlns:hw="http://filetransfer"
+    name="filetransferws">
+
+    <component name="FileTransferServiceComponent">
+        <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferServiceImpl"
/>
+	    <service name="FileTransferService">
+	        <interface.wsdl interface="http://filetransfer#wsdl.interface(FileTransfer)"
/>
+	        <binding.ws uri="http://localhost:8085/FileTransferService"/>
+	    </service>
+    </component>
+    
+    <component name="FileTransferClientComponent">
+        <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferClient"/>
+        <reference name="fileTransferWS" />
+    </component>
+    
+     <reference name="fileTransferWS" promote="FileTransferClientComponent/fileTransferWS">
+        <binding.ws uri="http://localhost:8085/FileTransferService"/>
+    </reference>
+
+</composite>



Mime
View raw message