| <?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"> |
| <html lang="en-us" xml:lang="en-us"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| <!-- /******************************************************************************* |
| * Copyright (c) 2000, 2005 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 |
| *******************************************************************************/ --> |
| <link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" /> |
| <title>Generating a Java client proxy and a sample application from |
| a WSDL document</title> |
| </head> |
| <body id="tsampapp"><a name="tsampapp"><!-- --></a> |
| |
| <h1 class="topictitle1">Generating a Java client proxy and a sample application |
| from a WSDL document using the IBM SOAP run-time environment</h1> |
| <div><p>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.</p> |
| <div class="p">Prerequisites:<ol><li id="tsampapp__createtomcatlinks"><a name="tsampapp__createtomcatlinks"><!-- --></a>If you are using the Apache Jakarta Tomcat servlet |
| container as your server, you must install it, configure an instance of it, |
| and create a Web project targeted to it as described in <a href="../../org.eclipse.jst.ws.axis.creation.ui.doc.user/tasks/ttomcatserv.html">Creating a WebSphere<sup>®</sup> Server and Web project</a></li> |
| <li id="tsampapp__prereqcreatewsprojs"><a name="tsampapp__prereqcreatewsprojs"><!-- --></a>If you are using a WebSphere server, create a dynamic |
| Web project targeted to the appropriate server as described in <a href="../../org.eclipse.jst.ws.doc.user/tasks/twasserv.html">Creating a WebSphere Server and Web project</a>.</li> |
| <li>Discover and import a WSDL document into the Web project. You can only |
| use a WSDL file that contains a service element.</li> |
| </ol> |
| </div> |
| <div class="section"><p>To generate a Java client proxy and a sample application |
| from a discovered WSDL document:</p> |
| </div> |
| <ol><li><span>Switch to the J2EE perspective (<span class="uicontrol">Window > Open Perspective |
| > J2EE</span>).</span></li> |
| <li><span>In the Project Explorer view, select the Web project in which you |
| want to generate a sample application.</span></li> |
| <li><span>Click <span class="uicontrol">File > New > Other</span>. Select <span class="uicontrol">Web |
| Services</span> in order to display the various Web service wizards. |
| Select the <span class="uicontrol">Web Service Client</span> wizard. Click <span class="uicontrol">Next</span>.</span></li> |
| <li><span>Web Services panel: Select the type of proxy to be generated, and |
| whether or not it will be tested.</span></li> |
| <li><span>Client Environment Configuration page: Select the run-time environment |
| and the server for your Web service client.</span><ol type="a"><li class="substepexpand"><span>Click <span class="uicontrol">Explore Options</span> and select the IBM<sup>®</sup> SOAP |
| run-time environment and select the server on which you want to run your Web |
| service client.</span> If you want to use the Apache Axis 1.0 run-time |
| environment or the IBM WebSphere run-time environments, refer to the appropriate |
| task. </li> |
| <li class="substepexpand"><span>Select the type and name of project in which you want the Web |
| service client created.</span> <ul><li> If you enter the name of an existing project, the project type field |
| must match that of the existing project. Ensure that the project selected |
| as the Client Web Project is different from the Service Web Project, or the |
| service will be overwritten by the client's generated artifacts.</li> |
| <li>If you enter a name of a project that does not already exist, the wizard |
| will create the project for you.</li> |
| <li>Note that the only project type supported for Axis and SOAP run-time clients |
| is a Web project. If you want the client to be created in a Java, EJB, |
| or Application Client project, you must select the WebSphere run-time environment for |
| your client.</li> |
| </ul> |
| </li> |
| <li class="substepexpand"><span> Select an existing EAR or enter a unique name to associate |
| the Web service client with a different EAR than the Web service EAR. <strong>Note:</strong> Selecting |
| different EARs for the Web service and Web service client can reduce the chance |
| of encountering run time errors, but will use more system resources.</span></li> |
| </ol> |
| </li> |
| <li><span>Web Service Selection panel: Enter the URI to the WSDL, WSIL, or |
| HTML file that will be used to generate the Java bean. You can optionally generate a |
| WSIL file from this file as well.</span></li> |
| <li><span>Web Service Binding Proxy Generation panel: Select the binding |
| and proxy options.</span></li> |
| <li><span>Web Service Proxy Test panel: Select the test facility that you |
| will use to test the proxy, and the methods that you want included in the |
| proxy. Note that the Universal Test Client (UTC) is only compatible with Web |
| service clients deployed on WebSphere servers. Click <span class="uicontrol">Finish</span></span></li> |
| </ol> |
| <div class="section"><p>Notes<sup>®</sup>:</p> |
| <ul><li>When defining custom mappings ensure the bean, serializer, and deserializer |
| classes are on the build path of the Web project, otherwise the wizard will |
| not accept their class names.</li> |
| <li>Indexed properties that result from WSDL XSD complex Types involving more |
| than one occurrence of DOM Elements are not supported by the sample. SOAP |
| encoded methods using indexed properties are not available for invocation. |
| Literal XML encoded methods using indexed properties are available for invocation; |
| however, the inputs and outputs must be specified as Literal XML.</li> |
| <li>Only the following types are supported by the sample application: <ul><li>Members that use getters and setters.</li> |
| <li>All primitive types and corresponding Java types.</li> |
| <li>Java type |
| String.</li> |
| <li>org.w3c.dom.Element</li> |
| <li>Java beans.</li> |
| <li>BigDecimal, GregorianCalendar, and Date.</li> |
| </ul> |
| </li> |
| </ul> |
| <p><strong>Important:</strong> It is recommended that you select the service WSDL |
| document rather than the binding WSDL document in order to generate a client |
| proxy that contains the complete endpoint information. The service element |
| is the basis for the Business Service that you will publish. You cannot publish |
| a Business Service using a WSDL document that does not have service elements. |
| If you generate a proxy from a WSDL binding document, you must call the <tt class="sysout">setEndPoint()</tt> method |
| to set an endpoint URL before you call any other method in the proxy. |
| The proxy generated from a WSDL binding document is not automatically equipped |
| with an endpoint URL.</p> |
| <p>The generated Java bean proxy provides a remote procedure |
| call interface to the Web service. The sample Web application demonstrates |
| how to code the proxy file.</p> |
| <p>Once you have generated your Java client |
| proxy, you may test the methods of the Web service through the proxy using |
| Web Services sample JSPs or the Universal test client.</p> |
| <ul><li>If you have selected to test the generated proxy using Web service JSPs, |
| the proxy is launched in a Web browser at the following URL:<samp class="codeph"> http://localhost: <var class="varname">port</var>/WebProjectClient/sample/ <var class="varname">WebService</var>/TestClient.jsp </samp> You can use this sample application to test the |
| Web service by selecting a method, entering a value for the method, and clicking |
| <span class="uicontrol">Invoke</span>. The result of the method will display in the |
| results pane.</li> |
| <li>If you have selected to test the generated proxy using the Universal Test |
| Client, it will be launched in a browser window at the following URL:<samp class="codeph"> <tt class="sysout">http://localhost:9080/UTC/preload?object=proxy.soap. <var class="varname">ProxyName</var>Proxy</tt> </samp> In the Reference pane, |
| under Object References, expand the proxy to display the methods of the Web |
| service. Click the method you want to test, enter a value in the Parameters |
| pane, and click <span class="uicontrol">Invoke</span>. The result will be generated |
| below.</li> |
| </ul> |
| <p>For more information on creating a Web project, refer to the Web application |
| development documentation.</p> |
| </div> |
| </div> |
| <div> |
| <div class="linklist"><strong>Collected links</strong><br /> |
| |
| <div><a href="../../org.eclipse.jst.ws.doc.user/concepts/cwsinwsa.html"> Tools for Web services development</a></div> |
| <div><a href="../../org.eclipse.jst.ws.doc.user/concepts/cws.html">Web services development</a></div></div> |
| |
| <div class="linklist"><strong>Related Tasks</strong><br /> |
| |
| <div><a href="tuddiexp.html" title="Through UDDI and WSIL, other applications can discover WSDL documents and bind with them to execute transactions or perform other business processes.">Publishing Web services and business entities</a></div></div> |
| |
| </div> |
| </body> |
| </html> |