| <?xml version="1.0" encoding="utf-8"?> |
| <!--Arbortext, Inc., 1988-2005, v.4002--> |
| <!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" |
| "../../dtd/task.dtd"> |
| <task id="twsbeana" xml:lang="en-us"> |
| <title>Creating a Web service from a <tm tmclass="special" tmowner="Sun Microsystems, Inc." |
| tmtype="tm" trademark="Java">Java</tm> bean using the Apache Axis run-time |
| environment</title> |
| <titlealts> |
| <searchtitle>Creating a Web service from a Java bean using the Apache Axis |
| run-time environment</searchtitle> |
| </titlealts> |
| <shortdesc>The Web Service wizard assists you in creating a new Web service, |
| configuring it for deployment, and deploying the Web service to a server. |
| Once your Web service is deployed, the wizard assists you in generating the |
| client proxy and sample application to test the Web service. When you have |
| completed testing, you can publish your Web service to a UDDI Business Registry |
| using the Export wizard.</shortdesc> |
| <taskbody> |
| <prereq><p>Prerequisites:<ol> |
| <li conref="tsklwsdla.dita#tsklwsdla/createtomcatlink"></li> |
| <li>Create or import a bean into the <tm tmclass="special" tmowner="Sun Microsystems, Inc." |
| tmtype="tm" trademark="Java">Java</tm> source folder of the Web project.</li> |
| </ol></p></prereq> |
| <context>To create a Web service from a bean using the Apache Axis run-time |
| environment:</context> |
| <steps> |
| <step><cmd>Switch to the J2EE perspective ( <uicontrol>Window > Open Perspective |
| > J2EE</uicontrol>).</cmd></step> |
| <step><cmd>In the Project Explorer view, select the bean that you created |
| or imported into the source folder of your Web project.</cmd></step> |
| <step><cmd>Click <uicontrol>File > New > Other</uicontrol>.</cmd><info>Select<uicontrol>Web |
| Services</uicontrol> in order to display the various Web service wizards. |
| Select the <uicontrol>Web Service</uicontrol> wizard. Click <uicontrol>Next</uicontrol>.</info> |
| </step> |
| <step><cmd>Web Services page: select <uicontrol>Bottom up Java bean Web service</uicontrol> as |
| your Web service type. You can optionally choose to do the following: </cmd> |
| <info id="createstep4ul"><ul> |
| <li>Start the Web service in a Web project - if you do not select this option |
| you will have to manually start the Web service. You must select this option |
| to enable the other options on this page.</li> |
| <li>Launch the Web Services Explorer to publish your Web service to a UDDI |
| registry.</li> |
| <li>Generate a <tm tmclass="special" tmowner="Sun Microsystems, Inc." tmtype="tm" |
| trademark="Java">Java</tm> bean client proxy to the Web service. The <tm tmclass="special" |
| tmowner="Sun Microsystems, Inc." tmtype="tm" trademark="Java">Java</tm> bean |
| client proxy that is generated provides a remote procedure call interface |
| to the Web service.</li> |
| <li>Test the Web service - this allows you to test the Web service in the |
| Web Service Explorer before a proxy is generated.</li> |
| <li>Send the Web service traffic through the TCP/IP Monitor, which allows |
| you to watch the SOAP traffic generated by the Web service and to test this |
| traffic for WS-I compliance. Note that this is only supported for Tomcat v4.0 |
| and v4.1. If you are using Tomcat v5.0 and want to monitor the Web service |
| traffic, you need to manually set up a TCP/IP monitor as described in <xref |
| href="../../org.eclipse.wst.wsi.ui.doc.user/tasks/tmonitor.dita" scope="peer">Using |
| the TCP/IP Monitor to test Web services</xref></li> |
| </ul></info></step> |
| <step><cmd>Object selection page: select the <tm tmclass="special" tmowner="Sun Microsystems, Inc." |
| tmtype="tm" trademark="Java">Java</tm> bean from which the Web service will |
| be created.</cmd></step> |
| <step><cmd>Service Deployment Configuration page: specify the server and client |
| deployment settings.</cmd> |
| <substeps> |
| <substep><cmd>Click <uicontrol>Edit</uicontrol> and select the Apache Axis |
| run-time environment and select the server on which you want to run your Web |
| service and Web service client.</cmd></substep> |
| <substep><cmd>Select the Web project in which you want your Web service created, |
| and the EAR with which it will be associated. </cmd><info>The wizard will |
| create these for you if they do not already exist.</info></substep> |
| <substep><cmd>Select the type and name of project in which you want the Web |
| service client created. If you enter the name of an existing project, the |
| project type field must match that of the existing project. If you enter a |
| name of a project that does not already exist, the wizard will create the |
| project for you. Note that the only project type supported for Axis clients |
| is a Web project. If you want the client to be created in a <tm tmclass="special" |
| tmowner="Sun Microsystems, Inc." tmtype="tm" trademark="Java">Java</tm>, EJB, |
| or Application Client project, you must select the <tm tmclass="ibm" tmowner="IBM Corporation" |
| tmtype="reg" trademark="WebSphere">WebSphere</tm> run-time environment for |
| your client.</cmd></substep> |
| <substep><cmd>Select an existing EAR or enter a unique name to associate the |
| Web service client with a different EAR than the Web service EAR. <b>Note:</b> 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.</cmd> |
| </substep> |
| </substeps> |
| </step> |
| <step><cmd>A message will display stating that you have made a WS-I non-compliant |
| selection.</cmd><info>The Apache Axis run-time environment is not WS-I compliant. |
| Select <uicontrol>Ignore</uicontrol>.</info></step> |
| <step><cmd>Web Service <tm tmclass="special" tmowner="Sun Microsystems, Inc." |
| tmtype="tm" trademark="Java">Java</tm> Bean Identity page: the Web service |
| URI and WSDL name will be listed.</cmd><info>You have the following |
| options:<ul> |
| <li>Select the methods to expose.</li> |
| <li>Select the encoding style. RPC/Encoded is the recommended encoding style |
| for the Axis run-time environment. This encoding method is not WS-I compliant.</li> |
| <li>Select if you want to customize the package to namespace mappings.</li> |
| </ul>Click <uicontrol>Next</uicontrol></info></step> |
| <step><cmd>Web Service Package to Namespace Mappings page: if you selected |
| <uicontrol>Define custom mapping for package to namespace</uicontrol> on |
| the previous panel, you can enter your custom mapping pairs on this panel |
| by clicking <uicontrol>Add</uicontrol>.</cmd></step> |
| <step><cmd>Web Service Test page: If you selected to test the Web service, |
| select the test facility for the generated Web service.</cmd><info>This will |
| open the Web service in the Web Services Explorer. Select the operation you |
| want to test, enter the required information, and click<uicontrol>Go</uicontrol>. |
| The result will display in the Status pane. Click <uicontrol>Next</uicontrol>.</info> |
| </step> |
| <step><cmd>Web Service Proxy page: if you have selected to generate a proxy, |
| select if you want to customize the package to namespace mappings.</cmd></step> |
| <step><cmd>Web Service Client Test page: Use this page to select the following |
| options: </cmd> |
| <substeps> |
| <substep><cmd>Select your test facility. You can test the generated proxy |
| in the Universal Test Client or the Web Service Explorer, or you can generate |
| a sample Web service JSP.</cmd></substep> |
| <substep><cmd>If you selected to test the proxy through a JSP, you can select |
| the folder where the JSP will be located, and you can select the methods that |
| will be included in the JSP.</cmd></substep> |
| <substep><cmd>Select <uicontrol>Run test on server</uicontrol> to start the |
| server for you automatically.</cmd></substep> |
| </substeps> |
| </step> |
| <step><cmd>Web Service Publication page: Select whether or not you want to |
| publish this Web service to a UDDI registry. Click <uicontrol>Finish</uicontrol>. </cmd> |
| <info>Note: you may see a warning stating <codeph>Error in generating WSDL |
| from Java. ClassNotFound: <bean name></codeph>. This error can be safely |
| ignored.</info></step> |
| </steps> |
| <result><p>After the Web service has been created, the following may occur |
| depending on the options you selected: <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: http://localhost: <varname>port</varname>/ <varname>WebProject</varname>Client/sample<i |
| >BeanName</i>/ <varname>WebServiceName</varname>/TestClient.jsp You can use |
| this sample application to test the Web service by selecting a method, entering |
| a value for the method, and clicking <uicontrol>Invoke</uicontrol>. 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: <systemoutput>http://localhost:9080/UTC/preload?object= <varname>BeanPackage</varname |
| >. <varname>BeanServiceProxy</varname></systemoutput>. In the Reference pane, |
| under Object References, expand the proxy stub to display the methods of the |
| Web service. Click the method you want to test, enter a value in the Parameters |
| pane, and click <uicontrol>Invoke</uicontrol>. The result will be generated |
| below.</li> |
| <li>If you have selected to test the Web service using the Web Services Explorer, |
| the Explorer will open. Select the operation you want to test, enter the required |
| information, and click <b>Go</b>. The result will display in the Status pane.</li> |
| <li>If you have selected to publish the Web service, the Web Services Explorer |
| is launched displaying the page required to publish your Web service. Follow |
| the instructions in <varname>Publishing the Web service</varname> to complete |
| this task.</li> |
| </ul></p><p> <uicontrol>Important:</uicontrol> If your methods contain types, |
| not supported by the sample, such as arrays, indexed properties, and collections, |
| the methods will be omitted from the sample and you will receive a warning |
| message.</p><p>Once you have created your Web service from a bean, you may |
| test the methods of your Web service, using the Universal Test Client, and |
| then publish your Web service to a UDDI Business Registry. For more information |
| on publishing your Web service using the Web Services Explorer, refer to Publishing |
| a Web service. For more information on the Universal Test Client, refer |
| to the Server tools online help.</p></result> |
| </taskbody> |
| <related-links> |
| <linklist><title>Related Concepts</title> |
| <link href="../../org.eclipse.jst.ws.doc.user/concepts/cwsinwsa.dita" scope="peer"> |
| <linktext> Tools for Web services development</linktext></link> |
| <link href="../../org.eclipse.jst.ws.doc.user/concepts/cws.dita" scope="peer"> |
| <linktext>Web services development</linktext></link> |
| </linklist> |
| <linklist><title>Related Tasks</title> |
| <link href="../../org.eclipse.jst.ws.doc.user/tasks/toverws.dita" scope="peer"> |
| <linktext> Developing Web services</linktext></link> |
| <link href="../../org.eclipse.jst.ws.consumption.ui.doc.user/tasks/tuddiexp.dita" |
| scope="peer"><linktext> Using the Web Services Explorer</linktext></link> |
| </linklist> |
| <linklist><title>Related Reference</title> |
| <link href="../../org.eclipse.jst.ws.doc.user/ref/rwsdl.dita" scope="peer"> |
| <linktext>WSDL documents</linktext></link> |
| </linklist> |
| </related-links> |
| </task> |