Overview of Web Services
Maria Lizarraga
CS526
Agenda
•
•
•
•
•
•
Definition
Benefits/Drawbacks
Architecture
Communication Process
Tools
Implementation
10/3/2015
Maria Lizarraga
Overview of Web Services Page 2
What is a web service?
• A web service is a web software application available
on the network that provides an interface for
exchanging information with a client.
– the software application
– a method to interface to the application
– URI associated with the application
– a published document that gives visibility to the
world
10/3/2015
Maria Lizarraga
Overview of Web Services Page 3
Benefits
•
•
•
•
Platform and Language Independent
Uses industry standards
Low cost internet communication
Reduces development effort
10/3/2015
Maria Lizarraga
Overview of Web Services Page 4
Drawbacks
• Less efficient, slow
• Hard to locate
• Requires learning a different set of development tools
and technology
10/3/2015
Maria Lizarraga
Overview of Web Services Page 5
Architecture
10/3/2015
Maria Lizarraga
Overview of Web Services Page 6
Web Services Description Language
(WSDL) Document
•
•
•
•
Name
Location
Operations
Data Types
See WSDL document.
10/3/2015
Maria Lizarraga
Overview of Web Services Page 7
Universal Description, Discovery, and
Integration (UDDI) Registry
• Publish Web Services
• Discovering Web Services
10/3/2015
Maria Lizarraga
Overview of Web Services Page 8
Simple Object Access Protocol,
SOAP Message
• XML
• Embedded into HTTP
• Three parts
– Envelope
– Header
– Body
10/3/2015
Maria Lizarraga
Overview of Web Services Page 9
Communication Process
10/3/2015
Maria Lizarraga
Overview of Web Services Page 10
Client Application
10/3/2015
Maria Lizarraga
Overview of Web Services Page 11
Request
SOAP Message
Application
POST /GradesService/services/GradesService HTTP/1.0 package grades;
Content-Type: text/xml; charset=utf-8
public class GradesService
Accept: application/soap+xml, application/dime,
{
multipart/related, text/*
final int NUMSTUDENTS = 4;
User-Agent: IBM WebServices/1.0
String[] students;
Host: localhost:9080
char[] grade;
Cache-Control: no-cache
public GradesService ( )
{
Pragma: no-cache
students = new String [] {"Mary", "Joe", "Sally", "Tim"};
SOAPAction: ""
grade = new char [] {'A', 'B', 'C', 'D'};
Content-Length: 356
} // end constructor
public char getStudentGrade (String student) {
<?xml version="1.0" encoding="UTF-8"?>
for (int i = 0; i < NUMSTUDENTS; i++)
<soapenv:Envelope
if (student.equals(students[i])) return grade[i];
xmlns:soapenv="http://schemas.xmlsoap.org/soap/
return 'Z';
envelope/"
} // end getStudentGrade
xmlns:soapenc="http://schemas.xmlsoap.org/soap/
public String getStudent (int studentID) {
encoding/"
return students[studentID];
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
} // end getStudent
xmlns:xsi="http://www.w3.org/2001/XMLSchemapublic String[] getStudents ( ) {
instance">
return students;
<soapenv:Body>
} // end getStudents
<getStudents xmlns="http://grades"/>
public static void main(String[] args){
</soapenv:Body>
GradesService gs = new GradesService();
</soapenv:Envelope>
for (int i = 0; i < gs.NUMSTUDENTS; i++)
System.out.println("Student: " + gs.getStudent (i) +
"\tGrade:” + gs.getStudentGrade(gs.getStudent(i)));
} // end main
} // end class GradesService
10/3/2015
Maria Lizarraga
Overview of Web Services Page 12
Response
HTTP/1.1 200 OK
Server: WebSphere Application Server/5.1
Content-Type: text/xml; charset=utf-8
Content-Language: en-US
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlso
ap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlso
ap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/X
MLSchema"
xmlns:xsi="http://www.w3.org/2001/XM
LSchema-instance">
<soapenv:Body>
<getStudentsResponse
xmlns="http://grades">
<getStudentsReturn>
Mary
</getStudentsReturn>
<getStudentsReturn>
Joe
</getStudentsReturn>
<getStudentsReturn>
Sally
</getStudentsReturn>
<getStudentsReturn>
Tim
</getStudentsReturn>
</getStudentsResponse>
</soapenv:Body>
</soapenv:Envelope>
•
10/3/2015
Maria Lizarraga
Overview of Web Services Page 13
Web Services Development
Platforms
• Java Web Services Development Pack (JWSDP)
• IBM WebSphere
• Systinet Web Applications and Services Platform
(WASP)
• Microsoft.NET
• HP Web Services Platform
10/3/2015
Maria Lizarraga
Overview of Web Services Page 14
WebSphere Implementation
•
•
•
•
•
•
•
•
Create an application
Create a server
Create a project
Create a service
Test the service
Create the client
Test the client
Publish the service
10/3/2015
Maria Lizarraga
Overview of Web Services Page 15
Summary
• Architecture
– UDDI Registry, Client and Server Applications
– WSDL
– SOAP
• Communication Process
– Application -> Stub -> Runtime -> SOAP Message
– Soap Message -> Runtime -> Ties -> Application
• Web Services Development Platforms
10/3/2015
Maria Lizarraga
Overview of Web Services Page 16
References
• IBM WebBench,
http://www-306.ibm.com/software/websphere/
• The Java Web Services Tutorial 1.0, August 7, 2002,
http://java.sun.com/webservices/docs/1.0/tutorial/
• Web Services Description Language (WSDL) 1.1,
http://www.w3.org/TR/wsdl
• UDDI web site, http://www.uddi.org
• SOAP Tutorial, http://www.w3schools.com/soap
• Deploying Web services with WSDL: Part 1, Bilal Siddiqui,
http://www-106.ibm.com/developerworks/library/ws-intwsdl/
10/3/2015
Maria Lizarraga
Overview of Web Services Page 17
Descargar

UTMOST