Tuscany Hello World JMS Client Sample

Overview

The Tuscany Hello World JMS client sample shows using the Tuscany SCA runtime in a J2SE environment invoking a service using XML over JMS.

Location

This sample is located  in the samples\sca\helloworld-jms\client directory.

Setup

This sample depends on the Tuscany runtime, Celtix, and the sample jar, sample-helloworldjms-client-incubating-M1.jar , all of these must be available on the classpath to run the sample. Additionally, the JMS server sample must also be running.

Running

In the directory samples/sca/helloworld use the JDK 1.5 java command to run the class helloworld.HelloWorldClient
Linux: java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar:../../../../lib/celtix/tuscany-celtix-incubating-M1.jar:target/sample-helloworldjms-client-incubating-M1.jar helloworld.HelloWorldClient
Windows: java -cp ../../../../lib/tuscany-runtime-incubating-M1.jar;../../../../lib/celtix/tuscany-celtix-incubating-M1.jar;target/sample-helloworldjms-client-incubating-M1.jar helloworld.HelloWorldClient

Results

The sample when run should simply display to the standard output:
Hello World

Code Overview

The source files are physically organized as shown below:
   src
   +---main
   +---java
   ¦   +---helloworld
   ¦           HelloWorldClient.java
   ¦           HelloWorldService.java
   ¦ 
   +---resources
   ¦   logging.properties
   ¦   sca.module
   ¦
   +---wsdl
           helloworld.wsdl 
   


sca.module Defines the SCA module, externalService and component. Defines for the HelloWorldServiceComponent component and the Java class that implements the component For the externalService it defines WSDL for the service, the Java interface provided by the service. The the HelloWorldServiceComponent is via a referenced wired to the externalService
HelloWorldClient.java Creates a Tuscany runtime and starts it.  Obtains the module context which was defined by the sca.module file. From the module context locates the HelloWorldService entryPoint and then calls  the getGreetings method to invoke the web service defined in the helloword.wsdl.
HelloWorldService.java Defines the Java interface implemented by the component.
helloworld.wsdl WSDL for the service. Not that the WSDL defines a XML binding using a JMS transport intead of the normal SOAP/HTTP