Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JAXWS/SmokeTestScenarios/"
< JAXWS
(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:'''. | + | ##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:'''. | + | ##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 | + | ##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: | + | #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
Contents
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
- Create a Dynamic Web Project.
- Import the 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.
- Move the service slider to the Test service stage.
- In the Service Configuration: section:
- Verify that Apache Tomcat is the selected Server:.
- 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.
- Click Next >.
- Select the Use a Service Endpoint Interface: checkbox.
- Select the Create an SEI radio button.
- Enter a name for the SEI in the text field.
- Click the Select All button.
- Click Finish. After creating the service, deploying to and starting Tomcat, the wizard will launch the Web Services Explorer.
- In the Web Services Explorer
- Under Operations in the right hand pane, click on farenheitToCelsius.
- In the float entry field enter a 72.0 and click Go.
- The Status pane should display return (float): 22.222221
Scenario 2: Create a Top Down Web Service
- Create a Dynamic Web Project.
- Import the 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.
- Move the service slider to the Test service stage.
- In the Service Configuration: section:
- Verify that Apache Tomcat is the selected Server:.
- 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.
- Click Finish.
- Open the generated implementation class org.tempuri.areaservice.AreaServiceImpl.
- Replace the generated method body of the calculateRectArea() method to return parameters.getHeight() * parameters.getWidth() and save the class.
- Restart the Apache Tomcat server.
- In the Web Services Explorer
- Under Operations in the right hand pane, click on CalculateRectArea.
- 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
Scenario 3: Create a Web Service Client
- Create a 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.
Scenario 4: Annotation Properties View
- Create a Dynamic Web Project.
- Import the 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.
Scenario 5: Annotation Validation and Quick Fixes
- Create a 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 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.
Scenario 6: Content Assist
- Create a Dynamic Web Project.
- Import the 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.