Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "Scout/Tutorial/3.7/Webservices with JAX-WS"

< Scout‎ | Tutorial‎ | 3.7
(Create Webservice Consumer)
(Removing all content from page)
 
(112 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Abstract ==
 
This tutorial is a guide to developing [http://jax-ws.java.net/ JAX-WS] webservices in [http://www.eclipse.org/scout/ Eclipse Scout]. JAX-WS stands for '''J'''ava '''A'''PI for '''X'''ML '''W'''eb '''S'''ervices. The JAX-WS version supported by Eclipse Scout is JAX-WS RI 2.1.6 bundled with Java SE 6. We are not using the lastest version (such as [http://jax-ws.java.net/2.2.5/ JAX-WS RI 2.2.5] because we encountered a lot of problems in having a newer version aside the Java built-in internal JAX-WS RI 2.1.6 implementation.
 
  
The scope of this tutorial is to create a simple Scout application with a webservice consumer and a webservice provider installed. The application will load company data from a [http://db.apache.org/derby/ Derby] database and allow the user to request a company's stock price with a 20 minute delay from the public [http://services.nexus6studio.com/StockQuoteService.asmx StockQuoteService]. Also, a webservice will be published to access the application's company data from within another application.
 
 
== Requirement ==
 
In order to run this tutorial, you require to have the latest Eclipse Scout Plug-Ins from the [http://download.eclipse.org/scout/nightly/update/ nightly updatesite]. That is because Scout JAX-WS integration is not part of the [http://www.eclipse.org/indigo/ Eclipse Indigo] release but of the [http://www.eclipse.org/downloads/index-developer.php Eclipse Juno] release planned for mid of 2012. For more information on the Eclipse release plan, please see [http://wiki.eclipse.org/Simultaneous_Release Eclipse releases].
 
 
== Resources ==
 
The Eclipse projects for this tutorial can be downloaded from our SVN at [https://dev.eclipse.org/svnroot/technology/org.eclipse.scout/scout.example/trunk/ scout.example]. All projects that belong to this tutorial start with the name ''org.eclipse.scout.tutorial.jaxws.*''
 
 
In order to run the tutorial you need to have the Derby database installed on your system. A ready-to-go database can be downloaded from [https://dev.eclipse.org/svnroot/technology/org.eclipse.scout/scout.example/trunk/org.eclipse.scout.tutorial.jaxws.database/database/org.eclipse.scout.tutorial.jaxws.database.zip org.eclipse.scout.tutorial.jaxws.database.zip]. Alternatively, the database can be created from scratch by using the SQL script [https://dev.eclipse.org/svnroot/technology/org.eclipse.scout/scout.example/trunk/org.eclipse.scout.tutorial.jaxws.database/script/create_database.sql create_database.sql] located in the Plug-In [https://dev.eclipse.org/svnroot/technology/org.eclipse.scout/scout.example/trunk/org.eclipse.scout.tutorial.jaxws.database org.eclipse.scout.tutorial.jaxws.database]. {{ScoutLink|Tutorials|Webservices with JAX-WS/Setup Derby database|Learn more}} on how to setup the derby database from scratch.
 
 
== Preliminary work  ==
 
First of all, you have to {{ScoutLink|Tutorials/Webservices with JAX-WS|Create Scout Project|create a new Scout project}}. Enter <code>org.eclipse.scout.tutorial.jaxws</code> as project name and choose <code>Outline Tree and Table Form</code> as template. {{ScoutLink|Tutorials/Webservices with JAX-WS|Configure Product Launch Configuration|Configure the product launch configuration}} to easily start the application.
 
Afterwards, {{ScoutLink|Tutorials|Webservices with JAX-WS/Create Derby SQL Service|create a Derby SQL Service}} to access company data and to persist webservice log entries. In order to display data from database, {{ScoutLink|Tutorials|Webservices with JAX-WS/Create Main Outline|create the Main Outline}} with a {{ScoutLink|Tutorials|Webservices with JAX-WS/Create Company Table Page|Company Table Page}} as its child page. In order to display stock quote information for a company, {{ScoutLink|Tutorials|Webservices with JAX-WS/Create Company Form|create a Company Form}}.
 
 
To track webservice requests, they are logged into the database in the course of this tutorial. This is why a {{ScoutLink|Tutorials|Webservices with JAX-WS/Create WsLogTablePage|WS Log Table Page}} and {{ScoutLink|Tutorials|Webservices with JAX-WS/Create WsLogForm|WS Log Form}} are to be created.
 
 
== Add JAX-WS support to the project  ==
 
In order to have JAX-WS support available in the project, add the Plug-In <code>org.eclipse.scout.jaxws216</code> to the server's required Plug-Ins in plugin.xml and to your product-files. {{ScoutLink|SDK|JAXWS-SDK/Add JAX-WS support to project|name=Learn more}} how to accomplish this.
 
 
== Create Webservice Consumer ==
 
On server node, go to the node <code>'Webservices (JAX-WS RI 2.1.6)' | 'Consumer' | ''''Services''''</code>. Right-click on that node to create a new webservice consumer [http://wiki.eclipse.org/Image:Org.eclipse.scout.jaxws.CreateConsumer_10.png]. In the first wizard step, choose the 2nd option <code>WSDL FROM URL</code> and enter the URL to the [http://en.wikipedia.org/wiki/Web_Services_Description_Language WSDL] file of the stock quote service provider [http://wiki.eclipse.org/Image:Org.eclipse.scout.jaxws.CreateConsumer_20.png]. In the course of this tutorial this would be [http://services.nexus6studio.com/StockQuoteService.asmx?wsdl http://services.nexus6studio.com/StockQuoteService.asmx?wsdl]. By pressing TAB or clicking somewhere outside the URL field, the WSDL file is evaluated. If this is about a valid WSDL file, click Finish to create the webservice consumer. {{ScoutLink|SDK|JAXWS-SDK/Create webservice consumer|name=Click here}} to learn more about webservice consumer creation. In case you encounter problems to build the webservice stub, refer to the {{ScoutLink|Tutorials|Webservices with JAX-WS/Console Output for StockQuoteService|name=Console Output}} for more information.
 
Please find the created webservice consumer <code>StockQuoteWebServiceClient</code> in Scout Explorer [http://wiki.eclipse.org/Image:Org.eclipse.scout.jaxws.consumer_10.png]. In the Scout Property View of this consumer, you can access the various files such as the WSDL file or the service type. Also, there you find links to rebuild the webservice stub, change build properties for stub generation process, for editing binding customization files and more. Also, the authentication mechanism can be changed in the section <code>Authentication</code>. For more information on that Property View, please {{ScoutLink|SDK|JAXWS-SDK/Webservice consumer Property View|name=click here}}.
 
 
Finally, we have to configure the endpoint URL of the webservice. For the sake of convenience, we hard-code this URL by specifying the property <code>URL</code> in the Property View [http://wiki.eclipse.org/Image:Org.eclipse.scout.jaxws.tutorial.consumer_10.png]. In real life, this would be done in config.ini to distinguish the different systems such as development, integration and production.
 
 
 
[[Image:Org.eclipse.scout.jaxws.CreateConsumer_10.png|thumb|Create webservice consumer]]
 
[[Image:Org.eclipse.scout.jaxws.CreateConsumer_20.png|thumb|Create webservice consumer]]
 
[[Image:Org.eclipse.scout.jaxws.consumer_10.png|thumb|Webservice Consumer]]
 
[[Image:Org.eclipse.scout.jaxws.tutorial.consumer_10.png|thumb|Set URL of webservice Endpoint]]
 

Latest revision as of 09:09, 24 April 2012

Back to the top