...
helloworld-contribution
This is the simplest a simple SCA contribution. This contribution It describes a composite application with a single component, HelloWorldComponent, implemented in Java. The component's Java implementation provides service "business logic" for saying hello to a person whose name is supplied as input to the service.
Panel | ||
---|---|---|
| ||
To build this contribution using Ant do the following: TODO |
...
bgColor | silver |
---|
To build this contribution using Maven do the following:
Code Block |
---|
cd helloworld-contribution
mvn
|
...
The component is described in a composite called helloworld.composite as follows:
Code Block | ||
---|---|---|
helloworld-contribution/target/helloworld-contribution.jar
You can run the contribution using Maven by doing the following:
|
Note | ||
---|---|---|
| ||
And then what? |
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://sample"
name="helloworld">
<component name="HelloworldComponent">
<implementation.java class="sample.HelloworldImpl"/>
</component>
</composite>
|
The contribution also contains a composite called helloworldws.composite which describes a component, HelloworldWSComponent, that uses the same implementation but uses a web services binding:
Code Block |
---|
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://sample"
name="helloworldws">
<component name="HelloworldWSComponent">
<implementation.java class="sample.HelloworldImpl"/>
<service name="Helloworld">
<binding.ws />
</service>
</component>
</composite>
|
This gives us a number of options for interacting with the components in this application.
Firstly there is a JUnit test inside this project called HelloworldTestCase.java. This starts the Tuscany runtime and loads the contribution. It then talks to the HelloworldComponent over the default SCA binding (binding.sca) using a local Java proxy.
Secondly the HelloworldWSComponent exposes a service with a web services binding. You can talk to this component using your favourite web services client. You can retrieve the WSDL for the web service automatically (see later)
Panel | ||
---|---|---|
| ||
To build this contribution using Ant do the following: TODO |
Panel | ||
---|---|---|
| ||
To build this contribution using Maven do the following:
|
This will produce the contribution as follows:
Code Block |
---|
helloworld-contribution/target/helloworld-contribution.jar
|
As the JUnit test deploys and runs the contribution we can use it as a first simple example of a running SCA application.
Panel | ||
---|---|---|
| ||
To run the JUnit test using Ant do the following: TODO |
Panel | ||
---|---|---|
| ||
The contribution will be run automatically during the Maven build step and you will see the output from the JUnit test printed on the console in amongst the other output:
|
To access the web service that the HelloworldWSComponent exposes we have to keep the runtime runntime running.
Panel | ||
---|---|---|
| ||
To run the sample Ant so that you can access the web service do the following: TODO |
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
We have a Maven plugin that will run SCA contributions. You use it in Maven as follows:
You will note that in the console output you can see a web service being exposed by the binding.ws JAXWS provider:
If you point you web browser at this address and add ?wsdl on the end:
You'll see the WSDL for the service returned. Using you're favourite web services client, for example, the Web Services Explorer in Eclipse, you can send messages to this web service. When you're done use CTRL-C to stop the sample. | ||||||
Note | ||||||
| ||||||
need description of structure and operation this application once we've decided what that should be |
For more information on getting started with the Apache Tuscany SCA Java runtime see the getting started page.
...
This sample is not a contribution in it's own right but demonstrates how to run the helloworld-contribution inside a web application. As it's the same contribution the same two components, HelloworldComponent and HelloworldWSComponnet, will be started.
Panel | ||
---|---|---|
| ||
To build this contribution using Ant do the following: TODO |
Panel | ||
---|---|---|
| ||
To build this contribution using Maven do the following:
|
This will produce a webapp as follows:
Code Block |
---|
helloworld-webapp/target/helloworld.war
|
You can run this webapp by deploying it to you're favourite webapp container. For example, you can deploy to Tomcat and run as follows:
Code Block | ||
---|---|---|
cp helloworld-webapp/target/helloworld.war my_tomcat_install/webapps my_tomcat_install/bin/catalina run | ||
Note | ||
| ||
Once running point your web browser at:
Code Block |
---|
http://localhost:8080/helloworld/hello.html
|
You'll see a link there to the WSDL that's automatically generated for the web service binding of the HelloworldWSComponent. Again you can use your favourite web services client to send messages to the service.
Note | ||
---|---|---|
| ||
need description of structure and operation this application once we've decided what that should beThere is no example of accessing binding.sca from within the webapp. Do we want to include this? |
Note | ||
---|---|---|
| ||
For more information on creating webapps to run SCA contributions with Tuscany see - ? |
...