Tuscany Hello World WS Client Sample

Overview

The Tuscany hello world WS client sample shows using the Tuscany SCA runtime in a J2SE environment invoking a web service.

Setup

The jars for a J2SE setup  including those necessary  for web services are required including the sample's own jar helloworldwsclient-SNAPSHOT.jar.

Running

Using JDK 1.5 java command with the previous mentioned jars run the class org.apache.tuscany.samples.helloworldwsclient.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:
main
+---java
¦   ¦   sca.module
¦   ¦
¦   +---org
¦       +---apache
¦           +---tuscany
¦               +---samples
¦                   +---helloworldwsclient
¦                           HelloWorldClient.java
¦                           HelloWorldService.java
¦                           HelloWorldServiceComponentImpl.java
¦
+---resources
    ¦   tuscany-model.config
    ¦
    +---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 HelloWorldServiceComponent and then calls  the getGreetings method to invoke the component.
HelloWorldService.java Defines the Java interface implemented by the component.
HelloWorldServiceComponentImpl.java It does not directly implement the service; instead it has an SCA reference that is wired in the sca.module to an externalService that will provide the service. The service providing the implementation is the helloworldws sample.
tuscany-model.config Maps the SCA Entry point WSDL to the physical WSDL file location.
helloworld.wsdl WSDL for the service.