Java Web Services. Sharmila Chalasani MS Computer Science State university of New York at Binghamton Termination Project Summer 2004. Outline. Introduction to web services Existing solutions Web service Architecture Standards used Web services technology JAX-RPC Architecture
MS Computer Science
State university of New York at Binghamton
More and more people get connected using computers, televisions, mobiles, …
We already have services on the Web, so what's missing?
Unless tomato buyers can communicate to tomato sellers, there will be no business.
-As many tomato buyers and sellers as possible.
-Being able to use any future new kind of tomatoes or any kind of products (potatoes, video games, …)
-Add new layers: security!
-Not all tomato buyers and sellers will use the same system or the same language.
Used by anyone, anywhere, and with any kind of devices.
Unless you want to buy your own tomatoes, it won't be useful.
Works well if the tomato seller uses your language
And about the Web?
An architecture view based on SOAP, WSDL, and UDDI.
XML (subset of XML 1.0), URL encoding.
Data format schema definition: XML Schema
XML Protocol (XML-RPC, SOAP), URI
Transfer protocol: HTTP, SMTP, JMS, BEEP, …
3 major Web services toolkits being used widely
-Java XML pack
-Tomcat Java Servlet
-JavaServer pages containers
-Ant build tool.
- Portable and interoperable web services
- Ease of development of web services endpoints & clients
- Increased developer productivity
- Support for open standards: XML, SOAP, WSDL
- Standard API developed under Java Community Process
- Support for tools
- RPC programming model with support for attachments
- Support for SOAP message processing model & extensions
- Secure web services
- Extensible type mapping
Ant Tool : This a tool extensively used in J2EE architecture for handling multiple configuration files while compiling several files. You can consider it similar to makeutility in unix platforms.
Build.xml : This is the file used by the Ant tool to get the compilation and path directives. It contains options to selectively compile-server, compile-client, generate-client, run-client etc
Build.properties :Some misc properties and path settings that are referred to by build.xml.
config.xml :Defines the URL for WSDL file location. Each Web services has a corresponding WSDL (Web service Definition Language) document.
jaxrpc-ri.xml: Defines the various end points for referencing a Web service.
wscompile: The wscompile tool generates stubs, ties, serializers, and WSDL files used in JAX-RPC clients and services. The tool reads as input a configuration file and either a WSDL file or an RMI interface that defines the service.
wsdeploy: Reads a WAR file (something like Jar file) and the jaxrpc-ri.xml file and then generates another WAR file that is ready for deployment
- boolean isvalidZipCode(String zip)
- String getWeatherReport(String zip)
- HashMap getZipcodeListMap()
- getHighTemp , getLowTemp, getHumidity,
getWind, getVisibility etc.
Communicating modes accessing web service
Stubs, dynamic proxy,DII(dynamic invocation interface)
Clients created to consume my weather service :
genereate stubs, compile client, package client, run the client
stubs are created before runtime (by wscompile), it is usually called a static stub. .It makes this call through a stub, a local object which acts as a proxy for the remote service.
This client creates a Service object which is factory of proxies(stubs are created at runtime dynamically)
This client used .jsp pages to display web form for the user to enter zipcode to get weather forecast by calling getWeatherReport function on the stubs created before.
description of services
enable security and privacy
describe complex interactions