Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Creating Web service and Web service client using Ant tasks"
(3 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
{| width="100%" cellspacing="5" cellpadding="2" | {| width="100%" cellspacing="5" cellpadding="2" | ||
| valign="top" | | | valign="top" | | ||
− | '''By Joan Haggarty'''<br /> | + | '''By Joan Haggarty'''<br /> June 23, 2008 <br /><br /> |
|- | |- | ||
| colspan="2" bgcolor="#0080c0" align="left" valign="top" | '''<font color="#ffffff" face="Arial,Helvetica">Introduction</font>''' | | colspan="2" bgcolor="#0080c0" align="left" valign="top" | '''<font color="#ffffff" face="Arial,Helvetica">Introduction</font>''' | ||
Line 14: | Line 14: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
− | This document is one of a series of tutorials to demonstrate the use of the Web Services tools in the Web Tools Platform Project with the '''WTP | + | This document is one of a series of tutorials to demonstrate the use of the Web Services tools in the Web Tools Platform Project with the '''WTP 3.0 drivers'''. |
|- | |- | ||
| valign="top" | | | valign="top" | | ||
Line 57: | Line 57: | ||
# Save the '''axis_tdjava.xml''' file. | # Save the '''axis_tdjava.xml''' file. | ||
# Edit the '''axis_tdjava.properties''' file. Check that <code>scenarioType=service</code> and set InitialSelection to a workspace relative path that points to the AreaService.wsdl: <code>InitialSelection=/testProject/WebContent/AreaService.wsdl</code>. '''Note:'''At this point, delete all of the other properties in the properties file. Only scenarioType and InitialSelection properties are required. The remaining properties in the properties file are examples and should be deleted if not explicitly set by the user. The Ant task will default the remaining properties based on the dynamic project settings and the scenarioType setting. | # Edit the '''axis_tdjava.properties''' file. Check that <code>scenarioType=service</code> and set InitialSelection to a workspace relative path that points to the AreaService.wsdl: <code>InitialSelection=/testProject/WebContent/AreaService.wsdl</code>. '''Note:'''At this point, delete all of the other properties in the properties file. Only scenarioType and InitialSelection properties are required. The remaining properties in the properties file are examples and should be deleted if not explicitly set by the user. The Ant task will default the remaining properties based on the dynamic project settings and the scenarioType setting. | ||
− | # Save the ''' | + | # Save the '''axis_tdjava.properties''' file. |
− | # Right click on the ''' | + | # Right click on the '''axis_tdjava.xml''' file and select '''Run As > Ant Build...''' |
# In the Ant dialog, click on the '''JRE''' tab and choose the radio button '''Run in the same JRE as the workspace'''. Click '''Apply''' and then '''Run'''<br />[[Image:Ws_antdialog.jpg]]<br /> | # In the Ant dialog, click on the '''JRE''' tab and choose the radio button '''Run in the same JRE as the workspace'''. Click '''Apply''' and then '''Run'''<br />[[Image:Ws_antdialog.jpg]]<br /> | ||
# Once the generation is complete, you will get a <tt>Build Successful</tt> message in the console. '''AreaServiceSOAP.wsdl''' should have been generated into the project's '''WebContent\wsdl''' folder as well as the Java code in the '''src''' folder for the '''testProject''' web project in the '''org.tempuri.AreaService''' package - | # Once the generation is complete, you will get a <tt>Build Successful</tt> message in the console. '''AreaServiceSOAP.wsdl''' should have been generated into the project's '''WebContent\wsdl''' folder as well as the Java code in the '''src''' folder for the '''testProject''' web project in the '''org.tempuri.AreaService''' package - | ||
Line 84: | Line 84: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
− | # Navigate to the plugins directory of your WTP installation. Change to the '''org.eclipse.wst.command. | + | # Navigate to the plugins directory of your WTP installation. Change to the '''org.eclipse.wst.command.env''' plugin directory and then go to the '''ant''' folder. The actual name of the plugin could be different from driver to driver, for example: '''D:\wtp30\eclipse\plugins\org.eclipse.wst.command.env_1.0.305.v200805281530\ant'''. Also, if you unzipped the WTP driver manually, the plugin could be in the '''dropins''' directory. |
# The following files should exist there: | # The following files should exist there: | ||
#* wsant.bat | #* wsant.bat | ||
Line 95: | Line 95: | ||
# Edit the '''axisclient.properties''' file. Check that <code>scenarioType=client</code> and set the InitialSelection property to a workspace relative path pointing to the AreaServiceSOAP.wsdl that was generated in the previous section of this tutorial. <code>InitialSelection=/testProject/WebContent/wsdl/AreaServiceSOAP.wsdl</code>. '''Note:'''At this point, delete all of the other properties in the properties file. Only scenarioType and InitialSelection properties are required. The remaining properties in the properties file are examples and should be deleted if not explicitly set by the user. The Ant task will default the remaining properties based on the dynamic project settings and the scenarioType setting. | # Edit the '''axisclient.properties''' file. Check that <code>scenarioType=client</code> and set the InitialSelection property to a workspace relative path pointing to the AreaServiceSOAP.wsdl that was generated in the previous section of this tutorial. <code>InitialSelection=/testProject/WebContent/wsdl/AreaServiceSOAP.wsdl</code>. '''Note:'''At this point, delete all of the other properties in the properties file. Only scenarioType and InitialSelection properties are required. The remaining properties in the properties file are examples and should be deleted if not explicitly set by the user. The Ant task will default the remaining properties based on the dynamic project settings and the scenarioType setting. | ||
# Save the '''axisclient.properties file'''. | # Save the '''axisclient.properties file'''. | ||
− | # Next, edit the '''wsant.bat''' file. Set the local environment variables to reflect your system configuration inluding the location of your JRE, the Eclipse | + | # Next, edit the '''wsant.bat''' file. Set the local environment variables to reflect your system configuration inluding the location of your JRE, the Eclipse launcher.jar (for example, <code>set LAUNCHER_JAR="%SHARED_DIRECTORY%\plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar</code>), and the workspace containing the web project and '''AreaServiceSOAP.wsdl''' file. |
# Save the '''wsant.bat''' file. | # Save the '''wsant.bat''' file. | ||
# Run '''wsant.bat''' by typing wsant at the command line. | # Run '''wsant.bat''' by typing wsant at the command line. |
Latest revision as of 14:31, 25 June 2008
Running Web service scenarios using Ant |
By Joan Haggarty | |
Introduction | |
| |
This document is one of a series of tutorials to demonstrate the use of the Web Services tools in the Web Tools Platform Project with the WTP 3.0 drivers. | |
This tutorial shows how to run Web services scenarios (top down web service, bottom up web service and client generation) without the web service wizard by way of an Ant task. | |
The Ant task can be invoked in one of two ways:
| |
Set up | |
| |
Before creating the Web service, there are two prerequisites: | |
| |
Service Generation - Using the Ant Task inside Eclipse | |
First, import the Ant files into the Eclipse workbench.
| |
Next, import the sample WSDL file AreaService.wsdl file into the WebContent folder of the dynamic web project testProject. | |
No matter where the task is invoked, required input needs to be provided to the Ant task by way of properties and a reference to the properties file updated from the Ant file. The properties file must specify the resource that will be used to generate the service. In this example, we will point to the AreaService.wsdl file in the testProject web project. The type of scenario needs to be specified as well. In this case, the scenario will be | |
| |
Note: | |
InitialSelection | |
| |
Client Generation - Using the Ant Task at the Command Line | |
Typically, you would use either the Eclipse or the command line mechanism to invoke the Ant task, not both. However, for the purposes of showing how the Ant tasks can be invoked, we'll switch out to the command line to demonstrate generating the client code. The next task is to generate a client for the AreaService web service using the same project and the WSDL file generated using the wsgen Ant task within Eclipse earlier. | |
|