Download presentation
Presentation is loading. Please wait.
1
An Introduction to Web Services
Sriram Krishnan, Ph.D.
2
Web Services: Definition
Many different definitions are available IBM (Gottschalk, et al): A web service is an interface that describes a collection of operations that are network accessible through standardized XML messaging. Microsoft (on MSDN): A programmable application logic accessible using standard Internet protocols. Another Web Service definition: A network service that provides a programmatic interface to remote clients Point to note is that Web services are for programmatic access, not human consumption. Unlike Websites
3
Web Services: Requirements
Accessible through standard Web protocols Interoperability is important Standard description language Publishable to a registry of services Discoverable via standard mechanisms Web Services != web sites/servers
4
Web Services: Features
Independent of programming language and OS Not bound to any single platform or specific protocol All information required to contact a service is captured by the Web Service Description Web Services Description encapsulates an interface definition, data types being used, and the protocol information Web Services description are platform neutral
5
Web Services Architecture
Registry Lookup Publish Service Requestor Service Provider Interact
6
Need to know three things about WS
What does the service do? How is the service accessed? Where is the service located?
7
Web Services Definition Language (WSDL)
Standard to describe the invocation syntax of a Web Service Authors: IBM, Microsoft and others WSDL is an XML document that describes Interface types for each port Content of messages it receives and sends Bindings of interfaces to protocols SOAP is default, others possible Describes the access points (host/port) for the protocol
8
Web Services Stack Service Discovery Layer Service Description Layer
Service Messaging Layer Service Transport Layer Framework Layer:.NET, Sun’s Open Net Env, provides hooks to the application to other web service layers Discovery: UDDI, web services publish and discovered Description: interface, transport Messaging: process of marshalling and unmarshalling of data Service Transport: technology for messages between applications: HTTP, SMTP, FTP
9
SoapStruct echoStruct(SoapStruct ss)
WSDL Elements PortTypes Message Types Binding Port Service SoapStruct echoStruct(SoapStruct ss)
10
<schema xmlns="http://www.w3.org/2001/XMLSchema">
WSDL: Types Types: collection of all data types used in the Web service (any schema language can be used, typically XML Schemas) referenced by messages <types> <schema xmlns=" <complexType name="SOAPStruct"> <all> <element name="varString" type="string"/> <element name="varInt" type="int"/> </all> </complexType> </schema> </types>
11
Message: abstract, typed definition of the data being sent
WSDL: Message Message: abstract, typed definition of the data being sent <message name="echoStructRequest"> <part name="inputStruct“ type="s:SOAPStruct"/> </message> <message name="echoStructResponse"> <part name="return" type="s:SOAPStruct"/>
12
<portType name="TestPortType">
WSDL: PortType portType: an abstract set of operations supported by one or more endpoints <portType name="TestPortType"> <operation name="echoStruct"> <input message="tns:echoStructRequest"/> <output message="tns:echoStructResponse"/> </operation> </portType>
13
WSDL: Binding Protocol Binding: details of how elements in PortType are converted into concrete representations <binding name="TestSoapBinding" type="tns:TestPortType"> <soap:binding style="rpc“ transport=" <operation name="echoStruct"> <soap:operation soapAction=" <input> <soap:body use="encoded" namespace=" encodingStyle=" </input> <output> </output> </operation> </binding>
14
Service: a named collection of ports
WSDL: Service and Port Service: a named collection of ports Port: how a binding is deployed to a particular endpoint <service name="TestService"> <port binding="tns:TestSoapBinding“ name="echo"> <soap:address location=" </port> </service>
15
Three properties of a Web service
PortType: What does the service do? Binding: How is the service accessed? Service: Where is the service located?
16
Web Services Stack Service Discovery Layer: WSIL, UDDI
Service Description Layer: WSDL, RDF Service Messaging Layer: SOAP Service Transport Layer: HTTP, SMTP Framework Layer:.NET, Sun’s Open Net Env, provides hooks to the application to other web service layers Discovery: UDDI, web services publish and discovered Description: interface, transport Messaging: process of marshalling and unmarshalling of data Service Transport: technology for messages between applications: HTTP, SMTP, FTP
17
WSDL Information Model
Separation between Abstract specification Concrete implementation of specification In WSDL Abstract: portType + messages Concrete: service + port + binding
18
SOAP = HTTP + XML XML HTTP Interoperability:
De facto standard for representing data in a platform independent way HTTP Simple universally supported protocol Interoperability: Easily understood Network Protocol: HTTP Common Data Format: XML Lightweight mechanism for exchanging structured information in a decentralized environment using XML SOAP just talks about encoding style for parameters Does not defined application semantics like a programming model
19
Characteristics of SOAP
XML based Internet-based Independent of Programming language Transport mechanism Can be used with protocols other than HTTP SMTP: Simple Mail Transfer Protocol JMS: Java Message Service
20
Example of SOAP request
POST /serv/echo HTTP/1.1 Host: Content-Type: text/xml Content-Length: 357 SoapAction:” <SOAP-ENV:Envelope xmlns:SOAP-ENV = SOAP-ENV:encodingStyle=“ <SOAP-ENV:Body> <m:echoStructRequest xmlns:m=“ <inputStruct> <varString>Stay Classy, San Diego!</varString> <varInt>2006</varInt> </inputStruct> </m:echoStructRequest> </SOAP-ENV:Body> </SOAP-ENV:Envelope> SOAP: 1 envelope: what is in a message, who should deal with it Encoding rules: serialization mechanism SOAP RPC: defines a convention that can be used to represent RPC SoapAction: used to direct the message to the appropriate handler Essentially one way transmission: but can be combined to implement a request/response pattern Body is what is meant for the ultimate recipient Encoding style: is to indicate the serialization rules in SOAP
21
Example of SOAP response
HTTP/ OK Content-Type: text/xml Content-Length: 343 <SOAP-ENV:Envelope xmlns:SOAP-ENV=“ SOAP-ENV:encoding=“ <SOAP-ENV:Body> <m:echoStructResponse xmlns=“ <return> <varString>I am Ron Burgundy?</varString> <varInt>2006</varInt> </return> </m:echoStructResponse> </SOAP-ENV:Body> </SOAP-Env:Envelope>
22
Apache Axis: http://ws.apache.org/axis/
Web Service Toolkits Apache Axis: One of the most popular toolkits User by several projects here like NBCR, GEON, CAMERA, GLEON Microsoft .NET: SUN: Several other lightweight implementations: XSUL, ZSI (Python), SOAP::Lite (Perl)
23
Writing a Web Service: Apache Axis
Define a Web service interface Use WSDL to define port types, messages, and data types Use a stub compiler to generate Java sources WSDL2Java generates client and server side bindings from the WSDL Also generates Web Services Deployment Descriptors (WSDD) WSDD contains information about the services like service name, implementation class, type mappings, etc
24
Writing a Web Service: Apache Axis (contd.)
Implement the service implementation (server-side) Deploy the service into a Container Jakarta Tomcat: Hosting environment - provides desirable features such as reliability, scalability, security, etc Write custom clients based on the generated stubs Can also write clients in other languages, viz. Python, Javascript, Perl, etc WSDD contains information about the services like service name, implementation class, type mappings, etc
25
Hopefully, we have a better idea of what Web services are
Summary Hopefully, we have a better idea of what Web services are What? How? Where? Next, we will see how Web services are applicable to the scientific community
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.