You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/09/27 11:45:05 UTC

svn commit: r579960 - in /incubator/tuscany/java/sca: modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/ modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/ samples/helloworld-...

Author: slaws
Date: Thu Sep 27 02:45:03 2007
New Revision: 579960

URL: http://svn.apache.org/viewvc?rev=579960&view=rev
Log:
TUSCANY-1806
Add support to binding-ws-axis2 for SOAP/JMS and extend the helloworld-ws-reference/service to show how it works
Thanks go to Dinesh Shahane for providing the patch

Added:
    incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldJmsClient.java
    incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsjmsclient.composite
    incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
    incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsTestServer.java
    incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldJmsServer.java
    incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/helloworldwsjms.composite
    incubator/tuscany/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldJmsServerTestCase.java
Modified:
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
    incubator/tuscany/java/sca/samples/helloworld-ws-reference/   (props changed)
    incubator/tuscany/java/sca/samples/helloworld-ws-reference/pom.xml
    incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl
    incubator/tuscany/java/sca/samples/helloworld-ws-service/   (props changed)
    incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.png
    incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg
    incubator/tuscany/java/sca/samples/helloworld-ws-service/pom.xml
    incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl

Modified: incubator/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/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java Thu Sep 27 02:45:03 2007
@@ -28,6 +28,10 @@
 import java.security.PrivilegedAction;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.wsdl.Definition;
 import javax.wsdl.Port;
@@ -40,10 +44,16 @@
 import javax.xml.transform.dom.DOMSource;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.transport.jms.JMSSender;
+import org.apache.axis2.transport.jms.JMSListener;
+import org.apache.axis2.transport.jms.JMSConstants;
+import org.apache.axis2.transport.jms.JMSUtils;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReferenceHelper;
 import org.apache.axis2.context.ConfigurationContext;
@@ -52,15 +62,19 @@
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.ModuleBuilder;
 import org.apache.axis2.deployment.util.Utils;
+import org.apache.axis2.description.AxisEndpoint;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
 import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.description.WSDLToAxisServiceBuilder;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.engine.ListenerManager;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.tuscany.sca.assembly.AbstractContract;
@@ -83,12 +97,16 @@
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 
 public class Axis2ServiceProvider {
+    
+    private final static Logger logger = Logger.getLogger(Axis2ServiceProvider.class.getName());    
 
     private AbstractContract contract;
     private WebServiceBinding wsBinding;
     private ServletHost servletHost;
     private MessageFactory messageFactory;
     private ConfigurationContext configContext;
+    private JMSSender jmsSender;
+    private JMSListener jmsListener;
 
     public static final QName QNAME_WSA_ADDRESS =
         new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS);
@@ -104,6 +122,7 @@
     // This port number may be used to construct callback URIs.  The value 8085 is used
     // beacuse it matches the service port number used by the simple-callback-ws sample.
     private static final String BASE_URI = "http://localhost:8085/";
+    private static final String DEFAULT_QUEUE_CONENCTION_FACTORY = "TuscanyQueueConnectionFactory";
 
     public Axis2ServiceProvider(RuntimeComponent component,
                                 AbstractContract contract,
@@ -115,6 +134,7 @@
         this.wsBinding = wsBinding;
         this.servletHost = servletHost;
         this.messageFactory = messageFactory;
+
         
         try {
             TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
@@ -155,23 +175,72 @@
         // service for every port
 
         try {
-            AxisService axisService = createAxisService(); 
-            configContext.getAxisConfiguration().addService(createAxisService());
+            AxisService axisService = createAxisService();
+            configContext.getAxisConfiguration().addService( axisService );
+          
+            if ( axisService.getEndpointURL().startsWith( "http" ) ) {
+                Axis2ServiceServlet servlet = new Axis2ServiceServlet();
+                servlet.init(configContext);
+                String servletURI = wsBinding.getURI();
+                configContext.setContextRoot(servletURI);
+                servletHost.addServletMapping(servletURI, servlet);
+            } else if ( axisService.getEndpointURL().startsWith( "jms" ) ) {
+                logger.log(Level.INFO,"Axis2 JMS URL=" + axisService.getEndpointURL() );
+                
+                jmsListener = new JMSListener();
+                jmsSender = new JMSSender();
+                ListenerManager listenerManager = configContext.getListenerManager();
+                TransportInDescription trsIn = configContext.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_JMS);
+
+                Map<String, String> jmsProps = JMSUtils.getProperties( wsBinding.getURI() );
+                OMFactory fac = OMAbstractFactory.getOMFactory();
+                OMElement parms = fac.createOMElement(DEFAULT_QUEUE_CONENCTION_FACTORY, null);
+                for ( String key : jmsProps.keySet() ) {
+                    OMElement param = fac.createOMElement("parameter", null);
+                    param.addAttribute( "name", key, null );
+                    param.addChild(fac.createOMText(param, jmsProps.get(key)));
+                    parms.addChild(param);
+                }
+                Parameter queueConnectionFactory = new Parameter(DEFAULT_QUEUE_CONENCTION_FACTORY, parms);
+                trsIn.addParameter( queueConnectionFactory );
+                trsIn.setReceiver(jmsListener);
+
+                configContext.getAxisConfiguration().addTransportIn( trsIn );
+                TransportOutDescription trsOut = configContext.getAxisConfiguration().getTransportOut(Constants.TRANSPORT_JMS);
+                //configContext.getAxisConfiguration().addTransportOut( trsOut );
+                trsOut.setSender(jmsSender);
+
+                if (listenerManager == null) {
+                    listenerManager = new ListenerManager();
+                    listenerManager.init(configContext);
+                }
+                listenerManager.addListener(trsIn, true);
+                jmsSender.init(configContext, trsOut);
+                jmsListener.init(configContext, trsIn);
+                jmsListener.start();
+            }
         } catch (AxisFault e) {
             throw new RuntimeException(e);
-        } 
+        }
 
-        Axis2ServiceServlet servlet = new Axis2ServiceServlet();
-        servlet.init(configContext);
-        String servletURI = wsBinding.getURI();
-        servletHost.addServletMapping(servletURI, servlet);
     }
 
     public void stop() {
-        servletHost.removeServletMapping(wsBinding.getURI());
+        if ( jmsListener != null ) {
+            jmsListener.stop();
+            jmsListener.destroy();
+        }
+        else {
+            servletHost.removeServletMapping(wsBinding.getURI());
+        }
+
+        if ( jmsSender != null )
+            jmsSender.stop();
+
         try {
             configContext.getAxisConfiguration().removeService(wsBinding.getURI());
-        } catch (AxisFault e) {
+        }
+        catch (AxisFault e) {
             throw new RuntimeException(e);
         }
     }
@@ -186,7 +255,7 @@
      * If the <binding.ws> has no wsdlElement but does have a uri attribute then
      * the uri takes precidence over any implicitly used WSDL.
      * 
-     * @param parent
+     * @param baseURI
      */
     protected URI computeActualURI(String baseURI, RuntimeComponent component, AbstractContract contract) {
 
@@ -338,9 +407,20 @@
         AxisService axisService = builder.populateService();
 
         String path = URI.create(wsBinding.getURI()).getPath();
-        axisService.setName(path);
+        String name = ( path.startsWith( "/") ? path.substring(1) : path );
+        axisService.setName(name);
+        String endpointURL = wsBinding.getURI();
+        axisService.setEndpointURL(endpointURL );
         axisService.setDocumentation("Tuscany configured AxisService for service: " + wsBinding.getURI());
-
+        for ( Iterator i = axisService.getEndpoints().values().iterator(); i.hasNext(); ) {
+            AxisEndpoint ae = (AxisEndpoint)i.next();
+            if (endpointURL.startsWith("jms") ) {
+                Parameter qcf = new Parameter(JMSConstants.CONFAC_PARAM, null);
+                qcf.setValue(DEFAULT_QUEUE_CONENCTION_FACTORY);
+                axisService.addParameter(qcf);
+                break;
+            }
+        }
         // Use the existing WSDL
         Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null);
         wsdlParam.setValue(definition);
@@ -428,7 +508,8 @@
         // create a message object and set the args as its body
         Message msg = messageFactory.createMessage();
         msg.setBody(args);
-
+        msg.setOperation( op );
+        
         // if reference parameters are needed, create a new "To" EPR to hold them
         EndpointReference to = null;
         if (callbackAddress != null ||

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml Thu Sep 27 02:45:03 2007
@@ -200,26 +200,9 @@
         <!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter>            -->
     </transportReceiver>
     
-    <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
-    <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
-        <parameter name="myTopicConnectionFactory">
-        	<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
-        	<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
-        	<parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
-        </parameter>
-
-        <parameter name="myQueueConnectionFactory">
-        	<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
-        	<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
-        	<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
-        </parameter>
-
-        <parameter name="default">
-        	<parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
-        	<parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
-        	<parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
-        </parameter>
-    </transportReceiver>-->
+     <!-- Added by Tuscany -->
+     <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+     </transportReceiver>
 
     <!-- ================================================= -->
     <!-- Non-blocking http/s Transport Listener  -->
@@ -302,8 +285,8 @@
         <parameter name="PROTOCOL">HTTP/1.1</parameter>
         <parameter name="Transfer-Encoding">chunked</parameter>
     </transportSender>
-    <!--<transportSender name="jms"-->
-                     <!--class="org.apache.axis2.transport.jms.JMSSender"/>-->
+    <transportSender name="jms"
+                     class="org.apache.axis2.transport.jms.JMSSender"/>
      
     <!-- ================================================= -->
     <!-- Non-blocking http/s Transport Sender  -->
@@ -419,9 +402,10 @@
                      class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
             <handler name="SOAPMessageBodyBasedDispatcher"
                      class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
-
+<!--
             <handler name="HTTPLocationBasedDispatcher"
                      class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+-->					 
         </phase>
         <phase name="RMPhase"/>
         <!--  System pre defined phases       -->
@@ -458,9 +442,10 @@
                      class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
             <handler name="SOAPMessageBodyBasedDispatcher"
                      class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
-
+<!--
             <handler name="HTTPLocationBasedDispatcher"
                      class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
+-->					 
         </phase>
         <phase name="RMPhase"/>
         <!--      user can add his own phases to this area  -->

Propchange: incubator/tuscany/java/sca/samples/helloworld-ws-reference/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Sep 27 02:45:03 2007
@@ -1,13 +1,14 @@
-target
-*.iws
-*.ipr
-*.iml
-.project
-.classpath
-maven.log
-velocity.log*
-junit*.properties
-.settings
-.deployables
-.wtpmodules
-work
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+.settings
+.deployables
+.wtpmodules
+work
+activemq-data

Modified: incubator/tuscany/java/sca/samples/helloworld-ws-reference/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-reference/pom.xml?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-reference/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-reference/pom.xml Thu Sep 27 02:45:03 2007
@@ -69,6 +69,13 @@
             <version>4.2</version>
             <scope>test</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>apache-activemq</artifactId>
+            <version>4.1.1</version>
+            <scope>test</scope>
+        </dependency>          
 
     </dependencies>
     

Added: incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldJmsClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldJmsClient.java?rev=579960&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldJmsClient.java (added)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldJmsClient.java Thu Sep 27 02:45:03 2007
@@ -0,0 +1,38 @@
+/*
+ * 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 helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldJmsClient {
+
+    public  final static void main(String[] args) throws Exception {
+        SCADomain scaDomain = SCADomain.newInstance("helloworldwsjmsclient.composite");
+        HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+        String value = helloWorldService.getGreetings("World");
+        System.out.println(value);
+
+        scaDomain.close();
+    }
+}

Added: incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsjmsclient.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsjmsclient.composite?rev=579960&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsjmsclient.composite (added)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsjmsclient.composite Thu Sep 27 02:45:03 2007
@@ -0,0 +1,45 @@
+<?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://helloworld"
+	xmlns:hw="http://helloworld"
+	name="helloworldwsclient">
+    
+    <!-- A component with an embedded reference definition connecting to an external webservice 
+         The wsdl interface for the reference is derived from the information specified by the 'wsdlElement'
+     -->
+    <component name="HelloTuscanyServiceComponent">
+      <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+      <reference name="helloWorldService">
+        <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapJmsPort)"/>
+      </reference>
+    </component>
+    
+    <!-- A component with a reference promoted as a composite reference -->
+    <component name="HelloWorldServiceComponent">
+      <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+    </component>
+    
+    <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService">
+        <interface.java interface="helloworld.HelloWorldService" />
+        <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapJmsPort)"/>
+    </reference>
+
+</composite>

Modified: incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl (original)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl Thu Sep 27 02:45:03 2007
@@ -70,9 +70,26 @@
         </wsdl:operation>
     </wsdl:binding>
 
+    <wsdl:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+        <wsdl:operation name="getGreetings">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getGreetingsRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="getGreetingsResponse">
+                <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:8085/HelloWorldService"/>
+        </wsdl:port>
+
+        <wsdl:port binding="tns:HelloWorldSoapJmsBinding" name="HelloWorldSoapJmsPort">
+            <wsdlsoap:address location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616"/>
         </wsdl:port>
     </wsdl:service>
 

Added: incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsClientTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsClientTestCase.java?rev=579960&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsClientTestCase.java (added)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsClientTestCase.java Thu Sep 27 02:45:03 2007
@@ -0,0 +1,76 @@
+/*
+ * 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 helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.activemq.broker.BrokerService;
+
+
+/**
+ * Test case for helloworld web service client 
+ */
+public class HelloWorldJmsClientTestCase {
+
+    private HelloWorldService helloWorldService;
+    private HelloWorldService helloTuscanyService;
+    private SCADomain scaDomain;
+    
+    private SCATestCaseRunner server;
+    private BrokerService broker = new BrokerService();
+
+    @Before
+    public void startClient() throws Exception {
+        try {
+            broker.addConnector("tcp://localhost:61616");
+            broker.start();            
+            scaDomain = SCADomain.newInstance("helloworldwsjmsclient.composite");
+            helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+            helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent");
+    
+            server =  new SCATestCaseRunner(HelloWorldJmsTestServer.class);
+            server.before();
+
+        } catch (Throwable e) {
+            e.printStackTrace();
+        }
+    }
+    
+    @Test
+    public void testWSClient() throws Exception {
+        String msg = helloWorldService.getGreetings("Smith");
+        Assert.assertEquals("Hello Smith", msg);
+   }
+    
+    
+    @After
+    public void stopClient() throws Exception {
+    	server.after();
+        scaDomain.close();
+	broker.stop();
+    }
+
+}

Added: incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsTestServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsTestServer.java?rev=579960&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsTestServer.java (added)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldJmsTestServer.java Thu Sep 27 02:45:03 2007
@@ -0,0 +1,53 @@
+/*
+ * 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 helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class HelloWorldJmsTestServer {
+
+    private SCADomain scaDomain;
+
+        @Before
+	public void startServer() throws Exception {
+            try {
+                	scaDomain = SCADomain.newInstance("helloworldwsjms.composite");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+	}
+
+
+	@After
+	public void stopServer() throws Exception {
+          scaDomain.close();
+	}
+
+}

Propchange: incubator/tuscany/java/sca/samples/helloworld-ws-service/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Sep 27 02:45:03 2007
@@ -1,13 +1,14 @@
-target
-*.iws
-*.ipr
-*.iml
-.project
-.classpath
-maven.log
-velocity.log*
-junit*.properties
-.settings
-.deployables
-.wtpmodules
-work
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+.settings
+.deployables
+.wtpmodules
+work
+activemq-data

Modified: incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.png
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.png?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
Binary files - no diff available.

Modified: incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg (original)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg Thu Sep 27 02:45:03 2007
@@ -30,13 +30,14 @@
    height="744.09448"
    id="svg2"
    sodipodi:version="0.32"
-   inkscape:version="0.44"
-   sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service"
+   inkscape:version="0.45.1"
+   sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service"
    sodipodi:docname="helloworld-ws-service.svg"
    version="1.0"
-   inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+   inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
    inkscape:export-xdpi="52.84"
-   inkscape:export-ydpi="52.84">
+   inkscape:export-ydpi="52.84"
+   inkscape:output_extension="org.inkscape.output.svg.inkscape">
   <defs
      id="defs4" />
   <sodipodi:namedview

Modified: incubator/tuscany/java/sca/samples/helloworld-ws-service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service/pom.xml?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-service/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-service/pom.xml Thu Sep 27 02:45:03 2007
@@ -61,7 +61,7 @@
             <artifactId>tuscany-host-tomcat</artifactId>
             <version>1.1-incubating-SNAPSHOT</version>
             <scope>runtime</scope>
-        </dependency>
+        </dependency>         
 
         <dependency>
             <groupId>junit</groupId>
@@ -69,6 +69,13 @@
             <version>4.2</version>
             <scope>test</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>apache-activemq</artifactId>
+            <version>4.1.1</version>
+            <scope>test</scope>
+        </dependency>        
 
     </dependencies>
     

Added: incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldJmsServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldJmsServer.java?rev=579960&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldJmsServer.java (added)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldJmsServer.java Thu Sep 27 02:45:03 2007
@@ -0,0 +1,60 @@
+/*
+ * 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 helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.activemq.broker.BrokerService;
+
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldJmsServer {
+
+    public static void main(String[] args) {
+
+        BrokerService broker = new BrokerService();
+        try {
+            broker.addConnector("tcp://localhost:61616");
+            broker.start();
+        } catch ( Exception e) {
+            e.printStackTrace();
+        }
+
+        SCADomain scaDomain = SCADomain.newInstance("helloworldwsjms.composite");
+
+        try {
+            System.out.println("HelloWorld server started (press enter to shutdown)");
+            System.in.read();
+        } catch ( Exception e) {
+            e.printStackTrace();
+        }
+
+        scaDomain.close();
+        System.out.println("HelloWorld server stopped");
+        
+        try {
+            broker.stop();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}

Added: incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/helloworldwsjms.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/helloworldwsjms.composite?rev=579960&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/helloworldwsjms.composite (added)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/helloworldwsjms.composite Thu Sep 27 02:45:03 2007
@@ -0,0 +1,34 @@
+<?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://helloworld"
+	xmlns:hw="http://helloworld"
+    name="helloworldws">
+
+    <component name="HelloWorldServiceComponent">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+	    <service name="HelloWorldService">
+	        <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+            <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapJmsBinding)"
+                    uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:61616"/>
+        </service>
+    </component>
+
+</composite>

Modified: incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl?rev=579960&r1=579959&r2=579960&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl (original)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl Thu Sep 27 02:45:03 2007
@@ -70,6 +70,19 @@
         </wsdl:operation>
     </wsdl:binding>
 
+    <wsdl:binding name="HelloWorldSoapJmsBinding" type="tns:HelloWorld">
+        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms"/>
+        <wsdl:operation name="getGreetings">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getGreetingsRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="getGreetingsResponse">
+                <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:8085/HelloWorldServiceComponent"/>

Added: incubator/tuscany/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldJmsServerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldJmsServerTestCase.java?rev=579960&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldJmsServerTestCase.java (added)
+++ incubator/tuscany/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldJmsServerTestCase.java Thu Sep 27 02:45:03 2007
@@ -0,0 +1,63 @@
+/*
+ * 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 helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.apache.activemq.broker.BrokerService;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldJmsServerTestCase{
+
+    private SCADomain scaDomain;
+    private BrokerService broker = new BrokerService();
+
+        @Before
+	public void startServer() throws Exception {
+           	broker.addConnector("tcp://localhost:61616");
+            broker.start();            
+		scaDomain = SCADomain.newInstance("helloworldwsjms.composite");
+	}
+
+    
+    @Test
+    public void testServiceCall() throws IOException {
+        HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService");
+        assertNotNull(helloWorldService);
+        
+        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+    }
+
+	@After
+	public void stopServer() throws Exception {
+            scaDomain.close();
+		broker.stop();
+	}
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org