Zainab AljazzafSupervisor: Dr. Hanan Lutfiyya
University of Western Ontario, Computer science department, Jan 2009
Contents:
• Definition• Technologies - SOAP - WSDL - UDDI• Implementation• References
University of Western Ontario, Computer science department, Jan 2009
What is WS?• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
• A new breed of Web application.• They are self-contained, self describing,
modular applications that can be published, located, and invoked across the Web.
• They perform functions, which can be anything from simple requests to complicated business processes.
• Once a Web service is deployed, other applications can discover and invoke it.
Why WS:
• A way to expose system functionality and make it available through standard web technologies:
- Reduce heterogeneity.
- Key to facilitating application integration.
- Enable new computing paradigm: Service
Oriented Computing.
- Reduce application development costs.
University of Western Ontario, Computer science department, Jan 2009
• Definition.• Technologies.• Implementation.
WS camps?
• Web services fall in two categories:
1- Big Web Services (WS-*).
2- RESTful Web Services.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Service oriented Architecture (SOA)
• The Programming paradigm continues to change: Procedural Object Oriented Service Oriented• SOA is a paradigm for organizing and utilizing distributed
capabilities that may be under the control of different ownership domains. It provides a uniform means to offer, discover, interact with and use capabilities to produce desired effects consistent with measurable preconditions and expectations. OASIS
• SOA is a collection of services that communicate with each other.
• SOA provides methods for systems development and integration where systems group functionality around business processes and package these as interoperable services.
• Aims at a loose coupling of services with operating systems, programming languages and other technologies.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Service oriented Architecture (SOA)• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
SOA Protocols:
WS protocols:
• SOAP (Simple Object Access Protocol)
• WSDL (Web Services Description Language)
• UDDI (Universal Description, Discovery and Integration)
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
WS extend web protocols:
• WS extend WWW protocols for supporting services instead of simple document access:
- SOAP extends HTTP: allow service requests. - WSDL extends HTML: allow to describe services. - UDDI extends URI: allow to locate services.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
W3C:
SOAP, WSDL, UDDI
XML-based documents
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
If Developers DO have sense:
Future applications will exchange their data in XML.
We can only pray that all the software vendors will agree
XML :
<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
SOAP:
• A lightweight protocol for exchanging structured information in a decentralized, distributed environment.
• A communication protocol between applications. • A format for sending messages. • XML-based protocol to let applications exchange
information over HTTP.• A platform and language independent • Allows to get around firewalls • A W3C recommendation(24. June 2003).
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Skeleton SOAP Message• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
<?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header> ... </soap:Header>
<soap:Body> ... <soap:Fault> ... </soap:Fault> </soap:Body>
</soap:Envelope>
SOAP Request:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
<?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header> <m:Trans xmlns:m="http://www.w3schools.com/transaction/" soap:mustUnderstand="1" soap:actor="http://www.w3schools.com/appml/ </m:Trans> </soap:Header>
<soap:Body> <m:GetPrice xmlns:m="http://www.w3schools.com/prices"> <m:Item>Apples</m:Item> </m:GetPrice> </soap:Body>
</soap:Envelope>
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
<?xml version="1.0"?><soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body> <m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices"> <m:Price>1.90</m:Price> </m:GetPriceResponse> </soap:Body>
</soap:Envelope>
SOAP Response:
WS example: TempConverter
• The following is a sample SOAP 1.1 request and response.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
POST /InStock HTTP/1.1Host: www.example.orgContent-Type: application/soap+xml; charset=utf-8Content-Length: length
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPrice> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body>
</soap:Envelope>
HTTP/1.1 200 OKContent-Type: application/soap+xml; charset=utf-8Content-Length: length
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock"> <m:GetStockPriceResponse> <m:Price>34.5</m:Price> </m:GetStockPriceResponse> </soap:Body>
</soap:Envelope>
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Soap req/resp:
Example from NetBeans:
SOAP Request:<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:add xmlns:ns2="http://cal2.org/"> <i>100</i> <j>250</j> </ns2:add> </S:Body></S:Envelope>
SOAP Response<?xml version="1.0" encoding="UTF-8"?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:addResponse xmlns:ns2="http://cal2.org/"> <return>350</return> </ns2:addResponse> </S:Body></S:Envelope>
WSDL:
• Used to describe Web services:
- What the service does?
- Where it located?
- How to invoke it? (data format and protocol to access the service).
• WSDL is a W3C recommendation (26. June 2007).
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
WSDL document:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Interface Definition
Implementation Description
WSDL document:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
<definitions> <types> Defines the data type uses XML Schema syntax </types>
<message> Defines the data elements of an operation. Each message can consist of one or more parts (parameters). </message>
<portType> Describes a web service, the operations that can be performed, and the messages that are involved. </portType>
<binding> Defines the message format and protocol details for each port. </binding> <service> Describes a web service. Provide network address of the service. </service>
</definitions>
InterfaceDefinition
ImplementationDescription
WSDL example (abstract)• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
<message name="getTermRequest"> <part name="term" type="xs:string"/></message>
<message name="getTermResponse"> <part name="value" type="xs:string"/></message>
<portType name="glossaryTerms"> <operation name="getTerm"> <input message="getTermRequest"/> <output message="getTermResponse"/> </operation></portType>
Port: function library Operation: function Input messageOutput message
Input parameter
Output parameter
WSDL Binding:
• WSDL bindings defines the message format and protocol details for a web service.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
<binding type="glossaryTerms" name="b1"><soap:binding style="document"transport="http://schemas.xmlsoap.org/soap/http" /> <operation> <soap:operation soapAction="http://example.com/getTerm"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation></binding>
WSDL port and operations:
• A WSDL port describes the interfaces (legal operations) exposed by a web service.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
UDDI:
• A directory for storing information about web services where businesses can register and search for Web services.
• Framework for describing and discovering business services, and service providers.
• Store web service interfaces described by WSDL.• Communicates via SOAP. • A platform-independent framework. • Other alternatives: ebXML (Electronic business XML) and
DSML (Directory Services Markup Language).• Control of UDDI given to OASIS.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
UDDI*:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
A mid-sized manufacturer needs to create 400 online relationships with customers, each with their own set of standard and protocols
BroaderB2B
A flower shop in Australia wants to be “plugged in” to every marketplace in the world, but doesn’t know how
SmarterSearch
Describe Services
Discover Services
IntegrateThemTogether
A B2B marketplace cannot get catalog data for relevant suppliers in its industry, along with connections to shippers, insurers, etc.
Easier Aggregation
* http://www.authorstream.com/
UDDI components:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Business description:- White PagesObtaining listings of organizations, contact info, list of general services provided
Service description:- Yellow PagesLook up information via standardized or userdefined taxonomies.
- Green pagesFull descriptions of individual web services. Provided by pointers to service descriptions, which are usually stored outside of the registry
Who – What - Where - How
WS stack:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
BPEL
UDDI
WSDL
SOAP
HTTP
NetBeans:
• A free, open-source Integrated Development Environment (IDE) for software developers.
• Get all the tools you need to create professional desktop, enterprise, web, and mobile applications.
• Use Java language, C/C++, and even dynamic languages such as PHP, JavaScript, Groovy, and Ruby.
• Runs on many platforms including Windows, Linux, Mac OS X and Solaris.
• Dedicated Support Available: programming advice, software support, and training credits.
• Service Oriented Architecture Support.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Requirement:
• Apache Axis2: - The core engine for Web services. - A complete re-design and re-write of the widely
used Apache Axis (an implementation of the SOAP).
- Provides the capability to add Web services interfaces to Web applications.
- Function as a standalone server application. - A server which plugs into servlet engines such as
Tomcat. - Has support for RESTful web services.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Architecture:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Cont.
• Servlet: Java classes that dynamically process requests and construct responses.
• Java Servlet API allows a software developer to add dynamic content (embeds HTML in java).
• Java's replacement for Common Gateway Interface (CGI) scripts.
• Can almost be thought of as an applet that runs on the server side.
• Server- and platform-independent. • Servlet lifecycle is governed by the servlet
container.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Cont.
• JavaServer Pages (JSP): Java technology allows software developers to dynamically generate HTML, XML or other types of documents in response to a Web client request.
• It embeds Java code in HTML (by using <% and %>). • Enables rapid development of web-based applications
that are server- and platform-independent.• Architecturally, JSP may be viewed as a high-level
abstraction of servlets. • JSPs are compiled into Java Servlets by a JSP
compiler.
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Cont.
• Apache Tomcat is is a servlet container developed by the Apache Software Foundation
• An implementation of the Java Servlet and JavaServer Pages (JSP) technologies.
• A Web container is the component of a Web server that interacts with the servlets
• Tomcat can act as a simple standalone server for Web applications that use HTML, servlets, and JSP.
• Provides a "pureJava“ HTTP web server environment for Java code to run.
• GlassFish is an open source application server project led by Sun Microsystems for the Java EE platform (Grizzly: the HTTP frontend of the application server).
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
The Setup :
• NetBeans IDE (6.5)
- JDK (5 or 6)
- Apache Axis2 (1.4)
- Java web or application server:
- Tomcat web server (6.0.1.8), or
- GlassFish application server (2)
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Create WS:• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Create WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Create WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Create WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Create WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Create WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Create WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Test WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Test WS:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Result:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
SOAP req/resp:
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
WSDL:
<?xml version="1.0" encoding="UTF-8" ?> - <!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-417-SNAPSHOT. --> - <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-417-SNAPSHOT. -->
- <definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://cal2.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://cal2.org/" name="cal_wsService"> - <types> - <xsd:schema> <xsd:import namespace="http://cal2.org/" schemaLocation="http://localhost:8081/Calculator2/cal_wsService?xsd=1" /> </xsd:schema> </types> - <message name="add"> <part name="parameters" element="tns:add" /> </message> - <message name="addResponse"> <part name="parameters" element="tns:addResponse" /> </message> - <portType name="cal_ws"> - <operation name="add"> <input message="tns:add" /> <output message="tns:addResponse" /> </operation> </portType>
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
Cont.
- <binding name="cal_wsPortBinding" type="tns:cal_ws"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <operation name="add"> <soap:operation soapAction="" /> - <input> <soap:body use="literal" /> </input> - <output> <soap:body use="literal" /> </output> </operation> </binding> - <service name="cal_wsService"> - <port name="cal_wsPort" binding="tns:cal_wsPortBinding"> <soap:address location="http://localhost:8081/Calculator2/cal_wsService" /> </port> </service></definitions>
• Definition.• Technologies.• Implementation.
University of Western Ontario, Computer science department, Jan 2009
References:
• W3C : http://www.w3c.org/• OASIS: http://www.oasis-open.org/home/index.php• NetBeans: http://www.netbeans.org• Tomcat: http://tomcat.apache.org/• Tomcat and Apache web server: http://www.coderanch.com/t/85639/Tomcat/ Difference-between-Tomcat-Apache-Web• Tomcate and GlassFish:http://java.dzone.com/articles/glassfish-and-tomcat-whats-the• Servlet and JSP: http://www.servlets.com/soapbox/problems-jsp.html • Web container and web server: http://www.coderanch.com/t/176596/Web-Component-Certification-SCWCD/certification/Web-Container-Web-server•Cesare Pautasso, Olaf Zimmermann, Frank Leymann, RESTful Web Services vs. “Big” Web Services:Making the Right Architectural Decision. pp. 805-814, Proceedings of the 17th International World Wide Web Conference, ACM Press, China, April 2008.•Seekda: the largest search engine for public Web Service: http://seekda.com/ • WS standards overview: http://www.innoq.com/soa/ws-standards/poster/innoQ %20WS-Standards%20Poster%202007-02.pdf