blob: 296efad04ce91a7407c098852b100529bed7ded2 [file] [log] [blame]
kprice6decb032008-04-01 19:05:41 +00001<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html lang="en-us" xml:lang="en-us">
3<head>
4<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
5<meta name="copyright" content="Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: IBM Corporation - initial API and implementation" />
6<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
7<meta content="public" name="security" />
8<meta content="index,follow" name="Robots" />
9<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
10<meta content="task" name="DC.Type" />
11<meta name="DC.Title" content="Generating a Java client proxy and a sample application from a WSDL document using the Axis2 runtime environment" />
12<meta name="abstract" content="The Web Service Client wizard assists you in generating a Java bean proxy and a sample application. The sample Web application demonstrates how to code a proxy file." />
13<meta name="description" content="The Web Service Client wizard assists you in generating a Java bean proxy and a sample application. The sample Web application demonstrates how to code a proxy file." />
14<meta content="Axis2 runtime environment, Web service clients, Web services, Web service clients" name="DC.subject" />
15<meta content="Axis2 runtime environment, Web service clients, Web services, Web service clients" name="keywords" />
16<meta scheme="URI" name="DC.Relation" content="../topics/caxis2tover.html" />
17<meta scheme="URI" name="DC.Relation" content="../../org.eclipse.jst.ws.doc.user/concepts/cwsinwsa.html" />
18<meta scheme="URI" name="DC.Relation" content="../../org.eclipse.jst.ws.doc.user/concepts/cws.html" />
19<meta scheme="URI" name="DC.Relation" content="../../org.eclipse.jst.ws.consumption.ui.doc.user/tasks/tuddiexp.html" />
20<meta content="XHTML" name="DC.Format" />
21<meta content="tsampappa" name="DC.Identifier" />
22<meta content="en-us" name="DC.Language" />
23<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
24<title>Generating an Apache Axis2 Java client proxy from a WSDL document</title>
25</head>
26<body id="tsampappa"><a name="tsampappa"><!-- --></a>
27
28
29<h1 class="topictitle1">Generating a Java client proxy and a sample application
30from a WSDL document using the Axis2 runtime environment</h1>
31
32
33
34
35<div><p>The Web Service Client wizard assists you in generating a Java™ bean
36proxy and a sample application. The sample Web application demonstrates how
37to code a proxy file.</p>
38
39<div class="p"><p>Prerequisites:</p>
40<ol>
41<li>You must have installed the Apache Axis2 runtime
42environment as described in: <a href="caxis2tover.html" title="This runtime environment is for users who prefer to develop for&#10;the open Apache Axis platform. Both Axis1 and Axis2 are supported by the Web&#10;services tools.">Creating Web services with the Apache Axis2 runtime environments</a></li>
43
44<li>If you are using the Apache Jakarta Tomcat servlet
45container as your server, you must install it, configure an instance of it,
46and create a Web project targeted to it as described in: <a href="../org.eclipse.jst.ws.axis.ui.doc.user/topics/ttomcatserv.html">Creating an Apache Tomcat server and Web project</a></li>
47
48<li>Discover and import a WSDL document into the Web project. You can only
49use a WSDL file that contains a service element.</li>
50
51</ol>
52</div>
53
54<div class="section">To generate a Java client proxy and a sample application
55from a discovered WSDL document:</div>
56
57<ol>
58<li><span>Switch to the J2EE perspective (<span class="uicontrol">Window &gt; Open Perspective
59&gt; J2EE</span>).</span></li>
60
61<li><span>In the Navigator view, select the Web project in which you want
62to generate a sample application.</span></li>
63
64<li><span>Click <span class="uicontrol">File &gt; New &gt; Other</span>. Select <span class="uicontrol">Web
65Services</span> in order to display the various Web service wizards.
66Select the <span class="uicontrol">Web Service Client</span> wizard. Click <span class="uicontrol">Next</span>.</span>
67</li>
68
69<li><span>Web Services page: </span>
70<ol type="a">
71<li class="substepexpand"><span>Enter the URI to the WSDL, WSIL, or HTML file that will be used
72to generate the client.</span></li>
73
74<li class="substepexpand"><span>Select the type of proxy to be generated</span></li>
75
76<li class="substepexpand"><span>Select the stages of Web services development that you want
77to complete using the slider:</span> <ul>
78<li>Develop: this will develop the WSDL definition and implementation of the
79Web service. This includes such tasks as creating the modules which will contain
80the generated code and Java files, as well as copying the Axis
81JARs..</li>
82
83<li>Assemble: this ensures the project that will host the Web service or client
84gets associated to an EAR when required by the target application server.</li>
85
86<li>Deploy: this will create the deployment code for the service.</li>
87
88<li>Install: this will install and configure the Web module and EARs on the
89target server.</li>
90
91<li>Start: this will start the server once the service has been installed
92on it. The server-config.wsdd file will be generated.</li>
93
94<li>Test: this will provide various options for testing the service, such
95as using the Web Service Explorer or sample JSPs.</li>
96
97</ul>
98</li>
99
100<li class="substepexpand"><span>Select your server: the default server is displayed. If you
101want to deploy your client to a different server click the link to specify
102a different server.</span></li>
103
104<li class="substepexpand"><span>Select your runtime: ensure the Apache Axis2 runtime is selected.</span>
105</li>
106
107<li class="substepexpand"><span>Select the client project: the project containing the project
108selected in your workspace is displayed. To select a different project and
109EAR click on the project link.</span> Ensure that the project selected
110as the Client Web Project is different from the Service Web Project, or the
111service will be overwritten by the client's generated artifacts.</li>
112
113<li class="substepexpand"><span>Monitor the Web service: this will send the Web service traffic
114through the TCP/IP Monitor, which allows you to watch the SOAP traffic generated
115by the Web service and to test this traffic for WS-I compliance. Alternately
116you can manually set up a TCP/IP monitor as described in <a href="../../org.eclipse.wst.wsi.ui.doc.user/tasks/tmonitor.html">Using the TCP/IP Monitor to test Web services</a></span></li>
117
118</ol>
119
120</li>
121
122<li><span>Axis2 Client Web service configuration
123page: Use this page to select the following options: </span>
124<ol type="a">
125<li><span>Service Name: accept the default.</span></li>
126
127<li><span>Port Name: accept the default.</span></li>
128
129<li><span>Databinding Name: only the Axis2 Databinding Framework (ADB)
130is supported at this time.</span></li>
131
132<li><span>Custom package name: You can change the package name in this
133field.</span></li>
134
135<li><span>Client mode: You can choose if the client is synchronous, asynchronous,
136or both.</span></li>
137
138<li><span>Generate test case to test the service: If you select this,
139the Axis2 emitter will generate JUnit testcases matching the WSDL provided
140to the client. These JUnit testcases will be generated to a newly added source
141directory to the client project called <span class="uicontrol">test</span>. </span>
142</li>
143
144<li><span>Generate all types for all elements referred by schemas</span>
145</li>
146
147<li><span>Namespace to package mapping: Use this table to review or edit
148the mappings between packages and namespaces.</span></li>
149
150</ol>
151
152</li>
153
154<li><span>Web Service Client Test page: Use this page to select the following
155options: </span>
156<ol type="a">
157<li><span>Select your test facility. You can test the generated proxy
158in the Web Service Explorer, or the Universal Test Client.</span></li>
159
160<li><span>Select <span class="uicontrol">Run test on server</span> to start the
161server for you automatically.</span></li>
162
163</ol>
164
165</li>
166
167<li><span>Click <span class="uicontrol">Finish</span>. If you have selected to test
168the proxy, the test client will open in a browser window.</span></li>
169
170</ol>
171
172<div class="section"><p>The generated Java bean proxy provides a remote procedure
173call interface to the Web service. The sample Web application demonstrates
174how to code the proxy file.</p>
175<p>Once you have generated your Java client
176proxy, you may test the methods of the Web service through the proxy using
177Web Services sample JSPs or the Universal test client.</p>
178<ul class="wsclienttestoptions">
179<li>If you have selected to test the generated proxy using Web service JSPs,
180the proxy is launched in a Web browser at the following URL: <samp class="codeph">http://localhost: <var class="varname">port</var>/ <var class="varname">WebProject</var>Client/sample<em>BeanName</em>/ <var class="varname">WebServiceName</var>/TestClient.jsp</samp> You
181can use this sample application to test the Web service by selecting a method,
182entering a value for the method, and clicking <span class="uicontrol">Invoke</span>.
183The result of the method will display in the results pane.</li>
184
185<li>If you have selected to test the Web service using the Web Services Explorer,
186the Explorer will open. Select the operation you want to test, enter the required
187information, and click <strong>Go</strong>. The result will display in the Status pane.</li>
188
189</ul>
190<p>For more information on creating a Web project, refer to the Web application
191development documentation.</p>
192</div>
193
194</div>
195
196<div>
197<div class="familylinks">
198<div class="parentlink"><strong>Parent topic:</strong> <a href="../topics/caxis2tover.html" title="This runtime environment is for users who prefer to develop for the open Apache Axis platform. Both Axis1 and Axis2 are supported by the Web services tools.">Creating Web services with the Apache Axis2 runtime environments</a></div>
199</div>
200
201<div class="linklist"><strong>Related Concepts</strong><br />
202
203<div><a href="../../org.eclipse.jst.ws.doc.user/concepts/cwsinwsa.html"> Tools for Web services development</a></div>
204<div><a href="../../org.eclipse.jst.ws.doc.user/concepts/cws.html">Web services development</a></div></div>
205
206<div class="linklist"><strong>Related Tasks</strong><br />
207
208<div><a href="../../org.eclipse.jst.ws.consumption.ui.doc.user/tasks/tuddiexp.html"> Using the Web Services Explorer</a></div></div>
209</div>
210
211</body>
212</html>