Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.
-
Upload
branden-newman -
Category
Documents
-
view
215 -
download
0
Transcript of Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.
![Page 1: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/1.jpg)
Developing Web Services Developing Web Services with the Eclipse Web with the Eclipse Web
Tools PlatformTools PlatformBoris MinkinBoris Minkin
![Page 2: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/2.jpg)
Web Services? What and why? Web Services? What and why?
• Companies need to integrate existing systems – achieve interoperability among disparate implementations
• Web Services and XML came along with the ability to provide standard communication interface between these systems
• They are essentially language/platform-neutral remote procedure calls built on HTTP infrastructure
![Page 3: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/3.jpg)
Fundamental standards and Fundamental standards and technologiestechnologies
• XML – eXtensible Markup Language: The syntax used for Web Service messages, configuration files, description files, etc.
• HTTP – Hypertext Transfer Protocol: The standard transport used to communicate between Web Service servers and clients
• RPC – Remote Procedure Call: The technique of executing a method call remotely—here, the client calling a web service’s operation.
![Page 4: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/4.jpg)
Web Service standards and Web Service standards and technologiestechnologies
• SOAP – Simple Object Access Protocol. An XML-based standard for sending messages (in a SOAP envelope) between web services and clients.
• WSDL—Web Service Definition Language XML-based description of a web services public interface. (Similar to CORBA IDL.)
• UDDI—Universal Description, Discovery and Integration. And XML-based registry for web service. Interrogated with SOAP messages, returns WSDL documents.
![Page 5: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/5.jpg)
Locating and Using Web ServicesLocating and Using Web Services
Web Service
UDDI Registry
Publish WSDL
Client Application
Query registry
Obtain WSDL
Call web serviceoperation
Get result back
![Page 6: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/6.jpg)
Java Web Service related Java Web Service related standards and protocolsstandards and protocols
• Web Services are Part of J2EE 1.4– Web Services for Java: JSR 101/109 standard– One can generate web service from Java Bean or
Stateless Session EJB
• Various Protocols and Standards:– JAXP—Java API for XML Processing– JAX-RPC—Java API for XML-based RPC– JAXR—Java API for XML registries– SAAJ—SOAP with Attachments API for Java– SAX—Simple API for XML processing– DOM API—Document Object Model API
![Page 7: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/7.jpg)
What is Eclipse?What is Eclipse?• Open-Source Java Integrated Development Environment
(IDE)• Initially donated by IBM to the Open-Source foundation• Includes:
– Java Development Tools (JDT)– Integrated Testing and Debugging Support– Incremental compilation and build– Team development support
• CVS support comes out of the box
• Pluggable – major advantage – can develop custom plug-ins – variety is available at sites such as:
• http://www.eclipseplugincentral.com/• http://eclipse-plugins.2y.net/eclipse/index.jsp
![Page 8: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/8.jpg)
Eclipse main conceptsEclipse main concepts• Workspace
– A workspace is a place where Eclipse stores the user’s data.– It’s a tree with projects, folders and files.– A workspace can contains many projects– You can have several workspaces but only one workspace can be
activated at a time.• Project
– Collection of folders and files• Workbench
– The workbench is the development environment window contains one or more perspectives
• Perspective– A layout with a set of editors and views– Some Perspectives include: Java, CVS, Debug, Resource, etc.
• Editor/View– Editors allow to edit content of a particular type (e.g., Java code editor)– Views present information in non-editable way (some views include Ant,
Console, Declaration, Error log, Hierarchy, Javadoc, Navigator, Outline, Package Explorer, Problems, Search
![Page 9: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/9.jpg)
Eclipse Web Tools Project (WTP) Eclipse Web Tools Project (WTP) PlatformPlatform
• One of the top Eclipse projects• Adds Web/J2EE/Web Services development facilities
– J2EE and Web perspectives– Web, EJB and Enterprise Application projects– Variety of editors and views for editing JSP/HTML, XML, other files
• Provides tools for:– Web applications using JSP / Servlets
• Provides editors for XML, HTML, JSP, JavaScript– Enterprise Java Beans (EJB)– Web Service (based on Apache AXIS)– Database exploration– Support for servers such as Tomcat, JBoss, etc.
• WTP Roadmap:– WTP 0.7, July 2005 – End User Tools– WTP 1.0, December 2005 – Platform APIs– WTP 1.5, June 2006 – Java EE 5.0
![Page 10: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/10.jpg)
Two ways to create Web Two ways to create Web Service with Eclipse WTPService with Eclipse WTP
• Bottom up:– You create the web service Java Bean or Stateless
Session EJB– Eclipse creates the glue classes and the WSDL
• Top down:– You write the WSDL– Eclipse creates the necessary glue classes and the
service’s method stubs in a Java Bean– You implement the operations
![Page 11: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/11.jpg)
Eclipse WTP – Web Services ToolsEclipse WTP – Web Services Tools• Wizard to create Web service
top-down (from WSDL) and bottom-up (from Java).
• Wizard creates a Java stub that binds to a Web service.
• Wizard can optionally configure test client and deployment of your Web service
• You can also specify to monitor your web service once its launched
![Page 12: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/12.jpg)
Eclipse WTP – Web Services ToolsEclipse WTP – Web Services Tools• Graphical WSDL/XSD Editor
– Edit your WSDL file without wrestling with the syntax
Containers for data type definitions using XML schema type system
Abstract, typed definitions of the data being communicated. A message can have one or more typed parts, for example the highlighted message getLatestDateTimeResponse has just one part which is its return parameter of xsd:date (XML Schema date type).
Abstract sets of one or more operations supported by one or more ports.
Concrete protocol and data format specifications for a particular port type
Collections of related ports
![Page 13: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/13.jpg)
Eclipse WTP – Web Services ToolsEclipse WTP – Web Services Tools
• XML Schema, WSDL, and WS-I validators– Ensure your documents conform to standards
(WSDL, XSD) and standard extensions (WS-I)
![Page 14: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/14.jpg)
Eclipse WTP – Web Services ToolsEclipse WTP – Web Services Tools
• Web Service Explorer– Publish/Discover Web
services.– Invoke Web services
dynamically. No code generation required for testing.
– One can go ahead and specify method parameters to invoke them
![Page 15: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/15.jpg)
Eclipse WTP – Web Services ToolsEclipse WTP – Web Services ToolsTCP/IP Monitor is a powerful facility to show data sent through
the wire and to simplify analysis of any possible problems
Shows the list of interactions (request/response) that have been performed in the chronological order.
Displays the contents of SOAP envelope generated by web services request.
Displays the SOAP response envelope
![Page 16: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/16.jpg)
A First Web Tools Project – Step 1A First Web Tools Project – Step 1
• Before we can make any web services we have to create a Dynamic Web Project in Eclipse.
• However, before we can make a dynamic Web Project, we need to configure a target server.
![Page 17: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/17.jpg)
A First Web Tools Project – Step 2A First Web Tools Project – Step 2
• Now, we are ready to create our Dynamic Web Project.
• Since Tomcat is just a Web Container provider, Web project is enough for it.
• For servers such as JBoss or WebSphere, you will need to create Enterprise Application Project.
![Page 18: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/18.jpg)
J2EE Scenario – Typical Web J2EE Scenario – Typical Web Services Application ArchitectureServices Application Architecture
• Java class accesses data from a database or another source
• Java class exposed as a Web service
![Page 19: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/19.jpg)
Our Sample Application DescriptionOur Sample Application Description
stockNamestockSymbol
StockService
getLatestPrice getLatestVolume
getLatestDateTime getStockName
getStockSymbolsetStockName
setStockSymbolgetStockHistory
StockData
• Just two Java classes – one for exposing the methods to be called through the service, – another for data gathering
pricevolume
dateTime
get/setPriceget/setVolume
get/setDateTime
1 1..N
![Page 20: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/20.jpg)
Free stuff !!!Free stuff !!!• You can go ahead and download yourself all
the software I’ll use in the demo:– J2SE 5.0 JRE: http://java.sun.com/j2se– Eclipse 3.1.2: http://www.eclipse.org– Eclipse Web Tools Project (WTP) 1.0:
http://ww.eclipse.org/webtools• You can download the complete set (including Eclipse itself
and all required components)• You can also install it using Eclipse Install/Update facility –
from Help menu select Software Updates – Find and Install, New Features to Install, then: New Remote Site with any name and URL: http://download.eclipse.org/webtools/updates/
– Tomcat 5.0/5.5: http://jakarta.apache.org/tomcat/
![Page 21: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/21.jpg)
Demo – Building Bottom-Up Web Demo – Building Bottom-Up Web ServiceService
• Create a web service, bottom-up• Exploring a Web Service using the Web
Services Explorer • Exploring generated WSDL using WSDL file
editor• Creating a simple client to invoke our web
service• Writing our own client• Create a web service, top down
![Page 22: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/22.jpg)
Invoke our Web Service from Java Invoke our Web Service from Java command line applicationcommand line application
• package services;• /**• * Creating a simple Java client to invoke Web Service through the generated service locator
and • * service end point interface.• */• public class StockServiceClient {• /**• * To invoke stock service• */• public static void main(String[] args) {• try{• StockServiceServiceLocator wsl = new StockServiceServiceLocator();• StockService ws = (StockService) wsl.getStockService();• String name = ws.getStockName();• System.out.println("Stock name: " + name);• double price = ws.getLatestPrice();• System.out.println("Stock price: " + price);• long volume = ws.getLatestVolume();• System.out.println("Stock volume: " + volume);• } catch (Exception e) {• e.printStackTrace();• }• }• }
![Page 23: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/23.jpg)
Invoke our Web Service from Invoke our Web Service from Microsoft .NET clientMicrosoft .NET client
• Demonstrates Web Services Interoperability
• Using Microsoft .NET 1.1 framework generation and compilation tools
• Sample program I’ve written in C#
![Page 24: Developing Web Services with the Eclipse Web Tools Platform Boris Minkin.](https://reader036.fdocuments.us/reader036/viewer/2022081603/56649e4f5503460f94b46fdc/html5/thumbnails/24.jpg)
To get more information…To get more information…
• WTP websitehttp://www.eclipse.org/webtools
• WTP newsgroupnews://news.eclipse.org/eclipse.webtools
• WTP Community Resources (articles, tutorials, events)
http://www.eclipse.org/webtools/community/community.html
• Article in Eclipse Developer Journal – Developing Web Services with Eclipse WTP:
http://eclipse.sys-con.com/read/180402.htm