Chapter 5. Building distributed SCA applications

Table of Contents

Hello World with Web Services
Expose the SCA service as a web service
Consume the webservice from a remote client
Calling a Weather service from FraSCAti
Weather service interface
Weather client implementation
Weather composite
Test the weather example
Configuration of webservice bindings

This chapter aims at illustrate building of distributed applications with SCA. In the first section we will use the previous HelloWorld example. We will show that client and server components can be distributed easily using the composite definition. In the second section we will give an example of an SCA client which use webservice binding to call a weather service over Internet.

Hello World with Web Services

This section will show how to expose an SCA service as a web service, or how to bind an SCA reference to external web service.

Expose the SCA service as a web service

Exporting an SCA service as a web service is very easy, as it doesn't require any SCA specific code. It is sufficient to add a element as subelement of the service definition and to define the URI to which make available the web service.


No SCA specific code is needed.

  1 <?xml version="1.0" encoding="ISO-8859-15"?>
  2 <composite xmlns=""
  3            name="helloworld-ws-server">
  5   <component name="server">
  6     < class="org.ow2.frascati.examples.helloworld.annotated.Server"/>
  7     <service name="printService">
  8       < uri="http://localhost:8080/PrintService"/>
  9     </service>
 10   </component>
 12 </composite>

Consume the webservice from a remote client

The PrintService is now available as a web service. Using this service is easily doable by setting the webservice binding on the client component.

  1 <?xml version="1.0" encoding="ISO-8859-15"?>
  2 <composite xmlns=""
  3            xmlns:wsdli=""
  4            name="helloworld-ws-client">
  6   <service name="r" promote="client/r">
  7     < interface="java.lang.Runnable" />
  8   </service>
 10   <component name="client">
 11     <reference name="printService">
 12       < wsdli:wsdlLocation="http://localhost:8080/PrintService?wsdl"
 13                   wsdlElement=""/>
 14     </reference>
 15     < class="org.ow2.frascati.examples.helloworld.annotated.Client" />
 16   </component>
 18 </composite>


For a remote execution, replace localhost with the IP or name of the host.