Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "JAXWS/SmokeTestScenarios/"

(New page: <h2>Prereqs</h2> * Download and Install the Apache CXF Runtime (version 2.2.x) from the [http://cxf.apache.org/download.html Apache CXF] downloads page. * Configure the Apache CXF Runtime ...)
 
Line 6: Line 6:
 
<h2>Scenario 1: Create a Bottom Up Web Service</h2>
 
<h2>Scenario 1: Create a Bottom Up Web Service</h2>
 
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
 
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
#Import the [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/srcfiles/wtp/Converter.java wtp/Converter.java] class into the source folder of Dynamic Web Project.
+
#Import the [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/srcfiles/wtp/Converter.java wtp/Converter.java] class into the source folder of the Dynamic Web Project.
 
#Right-click on the Converter.java class and select '''Web Services > Create Web Service''' to open the '''Web Service''' wizard.
 
#Right-click on the Converter.java class and select '''Web Services > Create Web Service''' to open the '''Web Service''' wizard.
#Move the slider to the '''Test service''' stage.
+
#Move the service slider to the '''Test service''' stage.
 
#In the Service '''Configuration:''' section:
 
#In the Service '''Configuration:''' section:
##Verify that Apache Tomcat is the selected '''Server:'''. ''(Or select an alternate server to deploy the web service to)''
+
##Verify that Apache Tomcat is the selected '''Server:'''.
##Select the '''Web service runtime:''' link and select 'Apache CXF 2.x' in the resulting dialog.
+
##Select the '''Web service runtime:''' link and select ''Apache CXF 2.x'' in the resulting dialog.
 
##Verify that the selected '''Service project:''' is the Dynamic Web Project that contains the Converter.java class.  
 
##Verify that the selected '''Service project:''' is the Dynamic Web Project that contains the Converter.java class.  
 
#Click '''Next >'''.
 
#Click '''Next >'''.
Line 21: Line 21:
 
#In the '''Web Services Explorer'''
 
#In the '''Web Services Explorer'''
 
##Under '''Operations''' in the right hand pane, click on '''farenheitToCelsius'''.
 
##Under '''Operations''' in the right hand pane, click on '''farenheitToCelsius'''.
##In the '''float''' entry field enter a 72.0 and click '''Go'''.
+
##In the '''float''' entry field enter a '''72.0''' and click '''Go'''.
##The '''Status''' pane should display '''return (float): 22.222221'''  
+
##The '''Status''' pane should display '''return (float): 22.222221'''
 +
 
 
<h2>Scenario 2: Create a Top Down Web Service</h2>
 
<h2>Scenario 2: Create a Top Down Web Service</h2>
 
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
 
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
 
#Import the [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/TopDownWebService/srcfiles/AreaService.wsdl AreaService.wsdl] into the Dynamic Web Project's '''WebContent''' folder.
 
#Import the [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/TopDownWebService/srcfiles/AreaService.wsdl AreaService.wsdl] into the Dynamic Web Project's '''WebContent''' folder.
#Right-click on the AreaService.wsdl file and select '''Web Services > Generate Java bean skeleton''' to open the '''Web Service''' wizard.
+
#Right-click on the ''AreaService.wsdl'' file and select '''Web Services > Generate Java bean skeleton''' to open the '''Web Service''' wizard.
#Move the slider to the '''Test service''' stage.
+
#Move the service slider to the '''Test service''' stage.
 
#In the Service '''Configuration:''' section:
 
#In the Service '''Configuration:''' section:
##Verify that Apache Tomcat is the selected '''Server:'''. ''(Or select an alternate server to deploy the web service to)''
+
##Verify that Apache Tomcat is the selected '''Server:'''.
##Select the '''Web service runtime:''' link and select 'Apache CXF 2.x' in the resulting dialog.
+
##Select the '''Web service runtime:''' link and select ''Apache CXF 2.x'' in the resulting dialog.
 
##Verify that the selected '''Service project:''' is the Dynamic Web Project that contains the AreaService.wsdl file.  
 
##Verify that the selected '''Service project:''' is the Dynamic Web Project that contains the AreaService.wsdl file.  
 
#Click '''Finish'''. ''
 
#Click '''Finish'''. ''
Line 38: Line 39:
 
#In the '''Web Services Explorer'''
 
#In the '''Web Services Explorer'''
 
##Under '''Operations''' in the right hand pane, click on '''CalculateRectArea'''.
 
##Under '''Operations''' in the right hand pane, click on '''CalculateRectArea'''.
##In the '''width float''' entry field enter a 12.0 and in the '''height float''' entry field enter 2.0 click '''Go'''.
+
##In the '''width float''' entry field enter '''12.0''' and in the '''height float''' entry field enter '''2.0''' and click '''Go'''.
##The '''Status''' pane should display '''area (float): 24.0'''  
+
##The '''Status''' pane should display '''area (float): 24.0'''
 +
 
 
<h2>Scenario 3: Create a Web Service Client</h2>
 
<h2>Scenario 3: Create a Web Service Client</h2>
 +
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
 +
#Open the '''Web Service Client''' wizard by selecting '''File > New > Other... > Web Services > Web Service Client''' from the top level menu.
 +
#Enter the URI of a remote WSDL file in the '''Service Definition:''' text field. ''e.g. the URL or the AreaService.wsdl from Scenario 2 after deploying to Tomcat''
 +
#Drop the client slider to '''Develop client'''.
 +
#In the '''Configuration:''' section:
 +
##Select '''Apache CXF 2.x''' as the '''Web service runtime'''.
 +
##Verify that the selected Client project: is the Dynamic Web Project that you created in step 1.
 +
#Click '''Finish'''. ''The generated client will include a main() method that when run will connect to the remote service and invoke every operation on that remote service.''
 +
#Navigate to the source folder of the Dynamic Web Project and open the generated client in the Java editor.
 +
#Edit the generated arguments that will be used to invoke the operations on the service.
 +
#To run the client right-click on the client in the Project Explorer and select '''Run As > Java Application'''.
 +
 
<h2>Scenario 4: Annotation Properties View</h2>
 
<h2>Scenario 4: Annotation Properties View</h2>
<h2>Scenario 5: Annotation Validation</h2>
+
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
<h2>Scenario 6: Quick Fixes and Content Assist</h2>
+
#Import the [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/srcfiles/wtp/Converter.java wtp/Converter.java] class into the source folder of the Dynamic Web Project.
 +
#Open the Converter.java class in the Java editor.
 +
#Open the '''Annotation Properties''' view by selecting '''Window > Show View > Other... > JAX-WS > Annotation Properties''' from the top level menu.
 +
#Select the ''Converter'' top level type. ''The view will react to the selection in the Java editor and display the applicable annotations''.
 +
#Select the checkbox in the '''Values''' column for the '''@javax.jws.WebService''' annotation to add the annotation to the type.
 +
#Expand the '''@javax.jws.WebService''' annotation entry in the '''Annotations Properties''' view.
 +
##Edit the element values using the cell editors and hit return. Confirm that the values are updated and saved in the Java editor.
 +
 
 +
<h2>Scenario 5: Annotation Validation and Quick Fixes</h2>
 +
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
 +
#Right-click on the Dynamic Web Project and select '''Properties'''.
 +
#On the '''Java Compiler > Annotation Processing''' properties page select '''Enable annotation processing'''.
 +
#Import the [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/srcfiles/wtp/Converter.java wtp/Converter.java] class into the source folder of the Dynamic Web Project.
 +
#Open the Converter.java class in the Java editor.
 +
#Annotate the class with the  '''@javax.jws.WebService''' annotation.
 +
#Change the ''public'' modifier of the '''farenheitToCelsius''' method to ''private''.
 +
#Add the '''@javax.jws.WebMethod''' annotation to the '''farenheitToCelsius''' method.
 +
#Confirm that the '''@WebMethod annotation is not allowed on non-public methods''' error message is displayed in the '''Markers''' view and that the '''farenheitToCelsius''' method is highlighted in the Java editor.
 +
#Right-click on the error in the '''Markers''' view and select '''Quick Fix'''.
 +
#In the '''Select a fix:''' list select '''Change method visibility to 'public' '''and click '''Finish'''.
 +
#Save the Converter.java file and confirm that the error is removed.
 +
 
 +
<h2>Scenario 6: Content Assist</h2>
 +
#Create a [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/CreateWebProject/CreateWebProject.html Dynamic Web Project].
 +
#Import the [http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/srcfiles/wtp/Converter.java wtp/Converter.java] class into the source folder of the Dynamic Web Project.
 +
#Open the Converter.java class in the Java editor.
 +
#Annotate the Converter.java class with the '''@javax.jws.WebService''' annotation without using the '''Annotation Properties''' view.
 +
#Add the '''serviceName''' element to the '''@javax.jws.WebService''' annotation with an empty string for a value. ''i.e. serviceName=""''
 +
#Place the cursor between the quotation marks and invoke content assist '''Ctrl-space'''.
 +
#Confirm that the value ''ConverterService'' was added.
 +
#Test other elements within the '''@javax.jws.WebService''' annotation and other JAX-WS annotations including '''@javax.xml.ws.BindingType'''.
  
 
[[Category:Eclipse_Web_Tools_Platform_Project]]
 
[[Category:Eclipse_Web_Tools_Platform_Project]]
 
[[Category:JAXWS| ]]
 
[[Category:JAXWS| ]]
 
[[Category:WebServices| ]]
 
[[Category:WebServices| ]]

Revision as of 18:01, 15 October 2009

Prereqs

  • Download and Install the Apache CXF Runtime (version 2.2.x) from the Apache CXF downloads page.
  • Configure the Apache CXF Runtime in the Window > Preferences > Web Services > CXF 2.x Web Services preference page.
  • Install the latest version of Apache Tomcat.

Scenario 1: Create a Bottom Up Web Service

  1. Create a Dynamic Web Project.
  2. Import the wtp/Converter.java class into the source folder of the Dynamic Web Project.
  3. Right-click on the Converter.java class and select Web Services > Create Web Service to open the Web Service wizard.
  4. Move the service slider to the Test service stage.
  5. In the Service Configuration: section:
    1. Verify that Apache Tomcat is the selected Server:.
    2. Select the Web service runtime: link and select Apache CXF 2.x in the resulting dialog.
    3. Verify that the selected Service project: is the Dynamic Web Project that contains the Converter.java class.
  6. Click Next >.
  7. Select the Use a Service Endpoint Interface: checkbox.
  8. Select the Create an SEI radio button.
  9. Enter a name for the SEI in the text field.
  10. Click the Select All button.
  11. Click Finish. After creating the service, deploying to and starting Tomcat, the wizard will launch the Web Services Explorer.
  12. In the Web Services Explorer
    1. Under Operations in the right hand pane, click on farenheitToCelsius.
    2. In the float entry field enter a 72.0 and click Go.
    3. The Status pane should display return (float): 22.222221

Scenario 2: Create a Top Down Web Service

  1. Create a Dynamic Web Project.
  2. Import the AreaService.wsdl into the Dynamic Web Project's WebContent folder.
  3. Right-click on the AreaService.wsdl file and select Web Services > Generate Java bean skeleton to open the Web Service wizard.
  4. Move the service slider to the Test service stage.
  5. In the Service Configuration: section:
    1. Verify that Apache Tomcat is the selected Server:.
    2. Select the Web service runtime: link and select Apache CXF 2.x in the resulting dialog.
    3. Verify that the selected Service project: is the Dynamic Web Project that contains the AreaService.wsdl file.
  6. Click Finish.
  7. Open the generated implementation class org.tempuri.areaservice.AreaServiceImpl.
    1. Replace the generated method body of the calculateRectArea() method to return parameters.getHeight() * parameters.getWidth() and save the class.
    2. Restart the Apache Tomcat server.
  8. In the Web Services Explorer
    1. Under Operations in the right hand pane, click on CalculateRectArea.
    2. In the width float entry field enter 12.0 and in the height float entry field enter 2.0 and click Go.
    3. The Status pane should display area (float): 24.0

Scenario 3: Create a Web Service Client

  1. Create a Dynamic Web Project.
  2. Open the Web Service Client wizard by selecting File > New > Other... > Web Services > Web Service Client from the top level menu.
  3. Enter the URI of a remote WSDL file in the Service Definition: text field. e.g. the URL or the AreaService.wsdl from Scenario 2 after deploying to Tomcat
  4. Drop the client slider to Develop client.
  5. In the Configuration: section:
    1. Select Apache CXF 2.x as the Web service runtime.
    2. Verify that the selected Client project: is the Dynamic Web Project that you created in step 1.
  6. Click Finish. The generated client will include a main() method that when run will connect to the remote service and invoke every operation on that remote service.
  7. Navigate to the source folder of the Dynamic Web Project and open the generated client in the Java editor.
  8. Edit the generated arguments that will be used to invoke the operations on the service.
  9. To run the client right-click on the client in the Project Explorer and select Run As > Java Application.

Scenario 4: Annotation Properties View

  1. Create a Dynamic Web Project.
  2. Import the wtp/Converter.java class into the source folder of the Dynamic Web Project.
  3. Open the Converter.java class in the Java editor.
  4. Open the Annotation Properties view by selecting Window > Show View > Other... > JAX-WS > Annotation Properties from the top level menu.
  5. Select the Converter top level type. The view will react to the selection in the Java editor and display the applicable annotations.
  6. Select the checkbox in the Values column for the @javax.jws.WebService annotation to add the annotation to the type.
  7. Expand the @javax.jws.WebService annotation entry in the Annotations Properties view.
    1. Edit the element values using the cell editors and hit return. Confirm that the values are updated and saved in the Java editor.

Scenario 5: Annotation Validation and Quick Fixes

  1. Create a Dynamic Web Project.
  2. Right-click on the Dynamic Web Project and select Properties.
  3. On the Java Compiler > Annotation Processing properties page select Enable annotation processing.
  4. Import the wtp/Converter.java class into the source folder of the Dynamic Web Project.
  5. Open the Converter.java class in the Java editor.
  6. Annotate the class with the @javax.jws.WebService annotation.
  7. Change the public modifier of the farenheitToCelsius method to private.
  8. Add the @javax.jws.WebMethod annotation to the farenheitToCelsius method.
  9. Confirm that the @WebMethod annotation is not allowed on non-public methods error message is displayed in the Markers view and that the farenheitToCelsius method is highlighted in the Java editor.
  10. Right-click on the error in the Markers view and select Quick Fix.
  11. In the Select a fix: list select Change method visibility to 'public' and click Finish.
  12. Save the Converter.java file and confirm that the error is removed.

Scenario 6: Content Assist

  1. Create a Dynamic Web Project.
  2. Import the wtp/Converter.java class into the source folder of the Dynamic Web Project.
  3. Open the Converter.java class in the Java editor.
  4. Annotate the Converter.java class with the @javax.jws.WebService annotation without using the Annotation Properties view.
  5. Add the serviceName element to the @javax.jws.WebService annotation with an empty string for a value. i.e. serviceName=""
  6. Place the cursor between the quotation marks and invoke content assist Ctrl-space.
  7. Confirm that the value ConverterService was added.
  8. Test other elements within the @javax.jws.WebService annotation and other JAX-WS annotations including @javax.xml.ws.BindingType.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.