summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-0.90/samples/helloworld-jsonrpc/README
blob: f57eb26920cacc9c5e5dfce4fba709dd26046f05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Hello World JSONRPC Sample
==========================
This sample demostrates the JSONRPC binding using a simple web app that
talks JSONRPC to an SCA service.  

The README in the samples directory (the directory above this) provides 
general instructions about building and running samples. Take a look there 
first. 

As this sample provides a web app there is a manual step where the WAR file
that contains the sample is copied to your web app container. If you just want 
to give this sample a go deploy the WAR file (target/sample-helloworldjsonrpc.war)
to you web application server. 

Once the web app is deployed use your browser to visit the following URL;

http://localhost:8080/sample-helloworldjsonrpc

The port and hostname will of course vary depending on your local installation. 

Sample Overview
---------------
The sample provides a single service which with an operation that reflects 
a greeting back to the called. The service is exposed using the JSONRPC
binding. The web app provided shows how the service can be called either via 
via the SCA provided JSON client or by using the DOJO toolkit. 

helloworl-jsonrpc/
  src/
    main/
      java/
        helloworldjsonrpc/
          HelloWorldService.java      - service interface
          HelloWorlsServiceImple.java - service implementation
      resources/
        jsonrpc.composite             - the SCA assembly for this sample
      webapp
        WEB-INF/
          web.xml                     - defines the listener that starts up the 
                                        Tuscany SCA runtime
        HelloWorldJSONRPC.html        - the web application that calls the 
                                        SCA service via JSONRPC
           
  helloworld-jsonrpc.png              - a pictorial representation of the 
                                        sample .composite file
  build.xml                           - the Ant build file that unpacks the
                                        dojo installation
  pom.xml                             - the Maven build file  

Building And Running The Sample Using Ant
-----------------------------------------
With the binary distribution the sample can be built using Ant as 
follows

cd helloworld-jsonrpc
ant package

This should result in a war file (sample-helloworldjsonrpc.war) in the target 
directory. Copy this war file to your web app deployment directory in you
web app container. 

The process for getting the web app running will depend on which web app container
you are using. For example, if you are using Tomcat then it is simply a matter
of copying the WAR file to the webapps directory. 

Once the web app is deployed use your browser to visit the following URL;

http://localhost:8080/sample-helloworldjsonrpc

The port and hostname will of course vary depending on your local installation. 

You should see a web page that allows you to send messages, via JSONRPC, to the 
application running in the Tuscany SCA Runtime

Building And Running The Sample Using Maven 
-------------------------------------------
With either the binary or source distributions the sample can be built and run 
using Maven as follows. 

cd helloworld-jsonrpc 
mvn

Again this should result in a war file (sample-calculator-web.war) in the target 
directory. Follow the steps described in the previous section for running the web 
app and for the expected results.