summaryrefslogtreecommitdiffstats
path: root/branches/sca-equinox/samples/callback-ws-client/README
blob: 66121362c90a479537cb23292f45b7feb6c9f3f8 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
Callback Web Services Client Sample
===================================
This sample demonstrates an SCA client that sends service requests to a
remote server and receives asynchronous callbacks from the server, using
Web service bindings for the service and the callback. 

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

If you just want to run it to see what happens, you need to start the
server first, so open a command prompt and navigate to the
callback-ws-service sample directory and do: 

ant run

OR if you don't have ant, on Windows do:

java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer

and on *nix do:

java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer

Once the server is running open a command prompt, navigate to this sample 
directory and do:

ant run

OR if you don't have ant, on Windows do:

java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-client.jar myapp.MyClientImpl

and on *nix do:

java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-client.jar myapp.MyClientImpl


Sample Overview
---------------
The sample has a single component that has a reference with a service
interface and a callback interface, with Web service bindings for both
these interfaces.  The service interface binding URI identifies the
service exposed by the callback-ws-service sample.

callback-ws-client/
  src/
    main/
      java/
        myapp/
          MyClient.java                - interface description for 
                                         MyClientComponent
          MyClientImpl.java            - component implementation
        myserver/
          MyService.java               - interface description for 
                                         MyServiceComponent
          MyServiceCallback.java       - interface description for callback 
      resources/
        myapp.composite                - the SCA assembly for this sample
    test/
      java/
        myapp/
          CallbackClientTestCase.java  - JUnit test case 
  callback-ws-client.png               - a pictorial representation of the 
                                         sample .composite file
  build.xml                            - the Ant build file
  pom.xml                              - the Maven build file        

Building And Running The Sample Using Ant
-----------------------------------------
With the binary distribution the sample can be built and run using Ant.
Before you do this, run the callback-ws-service sample to start up the
service that the client will talk to.  Take a look at the README in
that sample and you will see you need the following commands:

cd callback-ws-service
ant run

You can then compile and run this sample using the following commands:

cd callback-ws-client
ant compile
ant run

You should see the following output from the run target.

run:
     [java] 15-Jan-2008 10:21:38 org.apache.tuscany.sca.node.impl.SCADomainProxy
Impl init
     [java] INFO: Domain will be started stand-alone as domain URL is not provid
ed
     [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.domain.impl.SCADomainImp
l registerNode
     [java] INFO: Registered node: http://L3AW203:1336 at endpoint http://L3AW20
3:1336
     [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.node.impl.SCADomainProxy
Impl createRuntime
     [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea
se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu
bating-SNAPSHOT.jar
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
ddServletMapping
     [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainEventServi
ceProxyComponent
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
ddServletMapping
     [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainAPIService
ProxyComponent
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
ddServletMapping
     [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo
nent/SCANodeManagerService
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
ddServletMapping
     [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo
nent/ComponentManagerService/*
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
ddServletMapping
     [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo
nent/ComponentManagerService
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
ddServletMapping
     [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomain/scaDomain
.js
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl ac
tivateComposite
     [java] INFO: Building composite: {http://myapp}myapp
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
     [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl st
artComposite
     [java] INFO: Starting composite: {http://myapp}myapp
     [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a
ddServletMapping
     [java] INFO: Added Servlet mapping: http://L3AW203:1336/MyClientComponent/m
yService
     [java] aClientMethod on thread Thread[main,5,main]
     [java] aClientMethod return from someMethod on thread Thread[main,5,main]
     [java] receiveResult on thread Thread[pool-1-thread-2,5,main]
     [java] Result:  -> someMethod  -> receiveResult
     [java] Closing the domain
     [java] 15-Jan-2008 10:21:54 org.apache.tuscany.sca.node.impl.SCANodeImpl st
opComposite
     [java] INFO: Stopping composite: {http://myapp}myapp

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.  When using Maven you don't need to run the
callback-ws-service sample first as Maven does this for you.  With Maven,
both client and server code run in the same JVM, which rather defeats the
purpose of this sample (to show a standalone SCA client), but it's good
enough for a unit test. 

cd callback-ws-client
mvn

You should see the following output from the test phase.

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running myapp.CallbackClientTestCase
15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init
INFO: Domain will be started stand-alone as domain URL is not provided
15-Jan-2008 10:17:46 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo
de
INFO: Registered node: http://L3AW203:1322 at endpoint http://L3AW203:1322
15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR
untime
INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw
s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO
T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar
15-Jan-2008 10:17:52 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
15-Jan-2008 10:17:53 org.apache.catalina.startup.ContextConfig defaultWebConfig
INFO: No default web.xml
15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
1.dtd
15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
2.dtd
15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
0.xsd
15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
d
15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-1322
15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-1322
15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainEventServiceProxyCompo
nent
15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainAPIServiceProxyCompone
nt
15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/SCANode
ManagerService
15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone
ntManagerService/*
15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone
ntManagerService
15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1322/SCADomain/scaDomain.js
15-Jan-2008 10:17:53 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos
ite
INFO: Building composite: {http://callbackws}callbackws
15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite

INFO: Starting composite: {http://callbackws}callbackws
15-Jan-2008 10:17:54 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
15-Jan-2008 10:17:54 org.apache.catalina.startup.ContextConfig defaultWebConfig
INFO: No default web.xml
15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8086
15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8086
15-Jan-2008 10:17:54 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent
15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init
INFO: Domain will be started stand-alone as domain URL is not provided
15-Jan-2008 10:17:54 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo
de
INFO: Registered node: http://L3AW203:1323 at endpoint http://L3AW203:1323
15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR
untime
INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw
s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO
T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar
15-Jan-2008 10:17:56 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
15-Jan-2008 10:17:56 org.apache.catalina.startup.ContextConfig defaultWebConfig
INFO: No default web.xml
15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-1323
15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-1323
15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainEventServiceProxyCompo
nent
15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainAPIServiceProxyCompone
nt
15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/SCANode
ManagerService
15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone
ntManagerService/*
15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone
ntManagerService
15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1323/SCADomain/scaDomain.js
15-Jan-2008 10:17:56 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos
ite
INFO: Building composite: {http://myapp}myapp
15-Jan-2008 10:17:57 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite

INFO: Starting composite: {http://myapp}myapp
15-Jan-2008 10:17:57 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM
apping
INFO: Added Servlet mapping: http://L3AW203:1323/MyClientComponent/myService
aClientMethod on thread Thread[main,5,main]
aClientMethod return from someMethod on thread Thread[main,5,main]
setMyServiceCallback on thread Thread[pool-1-thread-1,5,main]
someMethod on thread Thread[pool-1-thread-1,5,main]
Sleeping ...
receiveResult on thread Thread[pool-2-thread-1,5,main]
Result:  -> someMethod  -> receiveResult
Closing the domain
15-Jan-2008 10:18:02 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite
INFO: Stopping composite: {http://myapp}myapp
15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-1323
15-Jan-2008 10:18:03 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite
INFO: Stopping composite: {http://callbackws}callbackws
15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8086
15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-1322
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.343 sec

This shows that the Junit test cases have run successfully.