summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-M2/samples/webapp/calculatorws/readme.html
blob: 5ddd8c58b792697cf25213ca3ce5c2c3bc97166d (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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.    
-->
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="Content-Style-Type" content="text/css"><title>Tuscany
Calculator Web Service Sample</title><!-- LINK rel="stylesheet" href="ait.css" type="text/css" --><!-- maven -->
<style type="text/css" media="all">
@import url("../../../../css/maven-base.css");
@import url("../../../../css/maven-theme.css");
@import url("../../../../css/site.css");
</style><link rel="stylesheet" href="./css/print.css" type="text/css" media="print"><!-- end maven --></head>
<body>
<H3>Tuscany Calculator-Combo - A Simple SCA Assembly that hosts calculator functions as  WebServices</H3>
<H3>Overview</H3>
<TABLE border="0">
	<TBODY>
		<TR>
			<TD width="100%" valign="top" align="left"> This sample is an assembly  of Calculator functions implemented in Java and exposed as Web Services. The primary objective of developing this sample is to support the Calculator-Combo sample.<BR>
			<BR>
			To test this sample you might have to either run the Calculator-Combo sample after running this sample or you might right your won SCA Application that refereences the services of this sample</TD>
		</TR>
	</TBODY>
</TABLE>
<H3>Location</H3>
<P>The source for this sample is located &nbsp;in the paths -  <I>samples\webapp\calculatorws</I>
 of the source
distribution.<BR>
<BR>
If there is binary distribution available for these samples, then you may find these samples packaged as <I>sample-calculatorws.war.</I><BR></P>
<H3>Building &amp; Running the CalculatorWS Sample Source</H3>
<P>If you are working with a source distribution, then you must first
build the source of this sample. <BR>
- Ensure that you have Java 5 installed on your system.<BR>
- Next, you must have Maven 2.0.4 installed on your system. Look up
http://maven.apache.org/download.html for downloading and installing
Maven.<BR>
 - Install the Apache Tomcat Server (latest release). Look up http://tomcat.apache.org/ for more information on releases and downloads.<BR></P>
<H4>Building the CalculatorWS Sample</H4>
<TABLE border="0">
	<TBODY>
		<TR>
			<TD valign="top"></TD>
			<TD valign="top">Having installed Maven, open a command line console
			and switch over to the directory on your local system, where you have
			extracted the source.<BR>
			- Now switch futher into the subdirectory <I>samples\webapp\calculatorws.
			</I>Within this directory execute the following command
			<TABLE border="0">
				<TBODY>
					<TR>
						<TD><FONT color="purple">&gt;</FONT></TD>
						<TD><FONT color="purple" face="Courier New">mvn</FONT></TD>
					</TR>
				</TBODY>
			</TABLE>
			This will build the <I>calculatorws</I> sample, package a WAR file for the composite and make it available in the sub-directory <I>samples\webapp\calculatorws\target</I></TD>
			<TD></TD>
		</TR>
	</TBODY>
</TABLE>
<H4>Running the CalculatorWS Sample </H4>
<P>Now that the sample source has been built and Tomcat setup, you may run the Calculator WebService sample as follows: -
</P>
<TABLE border="0">
	<TBODY>
		<TR>
			<TD valign="top">i)</TD>
			<TD>Copy the <I>sample-calculatorws.war</I> located in the <I>samples\webapp\calculatorws\target</I> into the WebApps directory of the Tomcat Installation.
			</TD>
		</TR>
		<TR>
			<TD valign="top">ii)</TD>
			<TD>Ensure that the Calculator Web Application is up and running.</TD>
		</TR>
	</TBODY>
</TABLE><H4><BR>
Trying the CalculatorWS Sample</H4>
<P>To test this sample completely, run the Calculator-Combo sample after running this sample. For details on setting up and running the Calculator-Combo sample look at the readme.html
under that sample.<BR>
<BR>
</P>
<H2>Code Overview</H2>
<P>The source files are physically organized as shown below:<BR>
</P>
<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"><tbody><tr><td>
<pre>
<B><U></U></B><B><U>Calculator WebService</U></B>
+---main<BR>    +---java<BR>    |   +---calculator
<I>               &lt;Interfaces and Implementations for Calculator Functions&gt;

</I> 
    +---resources
        +---wsdl
               calculator.wsdl
    +---webapp
        +---WEB-INF
               default.scdl
               web.xml</pre></td></tr></tbody></table>
<P><B>Calculator WebService Sample (WebApp Deployment)</B></P><TABLE border="1">
	<TBODY>
		<TR>
			<TD width="230" valign="top">default.scdl</TD>
			<TD width="396" valign="top">Defines an assembly of calculator
			funtions implemented in Java and exposed as a WebService using the Axis2 binding.</TD>
		</TR>
		<TR>
			<TD width="230">AddService.java<BR>
			AddServiceImpl.java<BR>
			DivideService.java<BR>
			DivideServiceImpl.java<BR>
			MathService.java<BR>
			MathServiceImpl.java<BR>
			MultiplyService.java<BR>
			MultiplyServiceImpl.java<BR>
			SubtractService.java<BR>
			SubtractServiceImpl.java</TD>
			<TD width="396">Java Interfaces and Java Implementations for various calculator
			functions.</TD>
		</TR>
		<TR>
			<TD width="230">CalculatorService.java<BR>
			CalculatorServiceImpl.java</TD>
			<TD width="396">Defines the coarse grained Calculator Interface and
			Implementation. This calculator implementation delegates function
			requests to other granular implemenations listed above.</TD>
		</TR>
		<TR>
			<TD width="230">calculator.wsdl</TD>
			<TD width="396">Defines the Calculator service using WSDL to enable the CalculatorServiceImpl to be exposed as a Axis2 WebService</TD>
		</TR>
		<TR>
			<TD width="230">web.xml</TD>
			<TD width="396">The Web App. descriptor for the Web App. deployment of the Tuscany Runtime.</TD>
		</TR>
	</TBODY>
</TABLE>
<P></P></body></html>