| <?xml version="1.0" encoding="UTF-8"?> |
| <?xml-stylesheet type="text/xsl" href="../../../../../wtp.xsl"?> |
| <html> |
| <head> |
| <meta name="root" content="../../../../../../" /> |
| <title>Top Down Web Service Tutorial</title> |
| </head> |
| <body> |
| <h1>Top Down Web Service Tutorial</h1> |
| <p> |
| <b>By Kathy Chan</b> |
| <br /> |
| Feb 25, 2005 |
| <br /> |
| <br /> |
| </p> |
| |
| <h2>Introduction</h2> |
| <br></br> |
| <p> |
| This document is a one of a series of tutorials to |
| demonstrate the use of the Web Services tools in the Web |
| Tools Platform Project. |
| </p> |
| <p> |
| This tutorial shows how to create a simple top-down Web |
| service from a WSDL file. The WSDL file in this scenario |
| calculates the area of an rectangle. |
| |
| </p> |
| <br></br> |
| |
| <h2>Getting Started</h2> |
| <br /> |
| <p> |
| Follow the instruction at |
| <a href="GettingStartedWebService.html"> |
| Getting Started with Web Service |
| </a> |
| before proceeding with the tutorial. |
| </p> |
| <br /> |
| |
| <h2>Set Up</h2> |
| <br></br> |
| <p> |
| Before creating the Web service, there are two |
| prerequisites: |
| <ol> |
| <li> |
| <a href="InstallTomcat.html"> |
| Install Apache Tomcat |
| </a> |
| </li> |
| <li>Create a Web project</li> |
| <ol> |
| <li> |
| Open |
| <b> |
| File -> New -> Other... -> Web -> J2EE Web |
| Project |
| </b> |
| to create a new Web project named |
| <tt>AreaProject</tt> |
| . |
| </li> |
| <li> |
| Enter |
| <tt>AreaProject</tt> |
| into the |
| <b>Name</b> |
| field. |
| </li> |
| <li> |
| Choose a |
| <b>Servlet version</b> |
| of |
| <b>2.3</b> |
| . |
| </li> |
| <li> |
| Choose a |
| <b>Target server</b> |
| of |
| <b>Apache Tomcat v4.1</b> |
| . |
| </li> |
| <li> |
| Deselect |
| <b>Add module to an EAR project</b> |
| . Result: |
| </li> |
| |
| <br></br> |
| <img border="0" |
| SRC="resources/TopDownWebService/image2C7.JPG" /> |
| <li> |
| Click |
| <b>Finish</b> |
| . |
| </li> |
| </ol> |
| |
| </ol> |
| </p> |
| |
| <h2>Create a top down Java bean Web service</h2> |
| |
| <ol> |
| <li> |
| Import the file |
| <a href="resources/TopDownWebService/AreaService.wsdl">AreaService.wsdl</a> |
| into AreaProject/WebContent. |
| </li> |
| |
| <li>Select the <b>AreaService.wsdl</b> file.</li> |
| |
| <li> |
| Open File -> New -> Other... -> Web Services -> Web |
| Service. |
| </li> |
| |
| <li> |
| In the Web service type combo, select |
| <b>Skeleton Java bean Web Service</b> |
| . |
| </li> |
| |
| <li> |
| Select |
| <b>Overwrite files without warning</b> |
| . Result: |
| </li> |
| <br /> |
| |
| <img border="0" |
| SRC="resources/TopDownWebService/imageJ3A.JPG" /> |
| <li> |
| Click |
| <b>Next</b> |
| . Result: |
| </li> |
| <br></br> |
| <img border="0" |
| src="resources/TopDownWebService/image0R7.JPG" /> |
| <li> |
| Click |
| <b>Next</b> |
| to get to the |
| <b>Service Deployment Configuration Page</b> |
| . Result: |
| </li> |
| <br></br> |
| <img border="0" |
| src="resources/TopDownWebService/imageIB0.JPG" /> |
| <li> |
| If you want to choose a server different |
| from the one defaulted by the wizard, click the |
| <b>Edit</b> |
| button to: |
| <a href="SelectServer.html"> |
| select a server |
| </a> |
| </li> |
| <li> |
| Click |
| <b>Finish</b>. |
| </li> |
| <li> |
| It will take about one minute for the wizard to assemble |
| the Web service projects, start Apache Tomcat and deploy |
| the projects to Tomcat. Once finished, the Java |
| implementation file |
| <b>AreaServiceSOAPImpl.java</b> |
| will appear in the browser view. Fill in |
| <b>parameters.getHeight()*parameters.getWidth()</b> |
| as the return value and save the file. |
| </li> |
| |
| <br /> |
| <img border="0" |
| SRC="resources/TopDownWebService/imageQB2.JPG" /> |
| </ol> |
| <p> |
| Follow the instruction at |
| <a href="WebServiceClient.html"> |
| Creating Web Service Client |
| </a> |
| to create a Web service client to test this Web service. |
| </p> |
| |
| </body> |
| </html> |