IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.
-
date post
21-Dec-2015 -
Category
Documents
-
view
218 -
download
1
Transcript of IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.
![Page 1: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/1.jpg)
IBM Labs in Haifa
J2EE Technologies: Web Services I
Benny RochwergerResearch Staff Member
![Page 2: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/2.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I2 © 2003 IBM Corporation
Agenda
Web Services: What is it about
XML Primer
Simple Object Access Protocol – SOAP
Describing Web Services – WSDL
Discovering Web Services – UDDI
Web Services in the Marketplace
What is next
The Open Grid Services Architecture
![Page 3: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/3.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I3 © 2003 IBM Corporation
Web Services Overview
An platform and language independent architecture for program to
program communications
A Web Service is a software component that can be:
Described using a service description language
Published to a registry of services
Discovered using a standard mechanism (at runtime or design time)
Invoked through a declared API (usually over the network)
Composed with other services
![Page 4: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/4.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I4 © 2003 IBM Corporation
Web Services Overview (cont.)
A Web Service is an interface that describes a collection of operations
that are network accessible through standardized XML messaging
A Web Service is described using a standard, formal XML notion, called
service description, which covers message formats, transport protocols
and location
The interface hides the implementation details of the service
![Page 5: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/5.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I5 © 2003 IBM Corporation
The Service Oriented Architecture (SOA)
ServiceProvider
ServiceProvider
ServiceRegistry
ServiceRegistry
ServiceRequestor
ServiceRequestor
Publish
Bind
Find
![Page 6: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/6.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I6 © 2003 IBM Corporation
The Web Services Stack
ServicePublication/Discovery
ServicePublication/Discovery
ServiceDescription
ServiceDescription
XML MessagingXML Messaging
Transport NetworkTransport Network
UDDI
WSDL
SOAP
HTTP, SMTP, MQSeries, etc.
![Page 7: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/7.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I7 © 2003 IBM Corporation
Web Services Advantages
Big players, such as IBM, Sun and Microsoft, actively support it Reuses the big infrastructure already built for the Web and the HTTP
protocol SOAP as the de facto standard of doing RPC over the web
It has the potential to become a lingua franca that you can fall back on when all else fails
CORBA’s IIOP has not penetrated the internet as HTTP has If SOAP can run on HTTP or any other Internet Protocol, it is bound
to enter the domain the IIOP has not
Web Services are poised to do to program to program interactions, what
the Web did for program to user interactions
![Page 8: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/8.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I8 © 2003 IBM Corporation
The eXtensible Markup Language - XML
Generalized Markup Languages
Use tags to identify information
Surround information with start and end tags
<book>
<title>Crime and Punishment</title>
<author>
<FirstName>Fyodor</FirstName>
<LastName>Dostoevsky</LastName>
</author>
<Published>1866</Published>
</book>
![Page 9: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/9.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I9 © 2003 IBM Corporation
The XML Evolution
1986 - Standard Generalized Markup Language (SGML)
Meta-language
Do not defined a particular markup
Define how to formally specify markup languages
SGML application
Specific markup languages defined with the SGML meta-language
Very complex
Expensive software needed to process SGML
![Page 10: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/10.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I10 © 2003 IBM Corporation
The XML Evolution (cont.)
1992 - Hypertext Markup Language (HTML)
Successful instance of a SGML application
Tags to represent rich hypertext:
Text structuring: <H1>, <H2>, <P>, <BR>
Formatting: <B>, <I>
Linking and embedding: <A>, <IMG>
Data input: <FORM>, <INPUT>
Not extensible
Vendors added incompatible tags
![Page 11: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/11.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I11 © 2003 IBM Corporation
The XML Evolution (cont.)
2000 – eXtensible Markup Language (XML)
Simplify SGML
Control evolution of HTML
As SGML, it is a meta-language
Few optional features
Difficult to implement SGML features were dropped
De-facto standard for representing structured and semi-structured
information in a textual form
![Page 12: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/12.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I12 © 2003 IBM Corporation
Document-Centric vs. Data-Centric
Document-Centric XML
Semi-structured documents
Technical manuals, legal documents, product catalog
Typically consumed by humans
Data-Centric XML
Textual representation of highly structured information
Relational data, financial transactions, programming languages data
structures
Typically machine generated and consumed
![Page 13: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/13.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I13 © 2003 IBM Corporation
XML Instances
<?xml version=“1.0” encoding=“UTF-8” ?>
<PhoneBook>
<Contact>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
<phone location=“home”>
04 987 6543
</phone>
<phone location=“work”>
04 876 5432
</phone>
</Contact>
</PhoneBook>
XML DeclarationRoot element
Element
Attribute
Text
![Page 14: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/14.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I14 © 2003 IBM Corporation
XML Namespaces
Avoid collisions in elements with common names by qualifying element names with unique identifiers
QName = Namespace identifier + element name Use URIs for identifiers (entirely for identification) To ease use of identifiers assign each URI a prefix
Defined through attributes, valid for all contained elements:
<Contact xmnls:myab=“http://my.company.com/addressbook”xmnls:bezeqab=“http://bezeq.co.il/addressbook”><myab:entry>
<myab:name>John Doe</myab:name></myab:entry><bezeqab:entry>
<bezeqab:FirstName>John</bezeqab:FirstName><bezeqab:LastName>Doe</bezeqab:LastName>
</bezeqab:entry></Contact>
![Page 15: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/15.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I15 © 2003 IBM Corporation
XML Schemas
Mechanism to specify:
the datatype of each element/attribute "this element shall hold an integer with the range 0 to 12,000"
the structure of instance documents "this element contains these elements, which contains these other elements,
etc"
Declarative mechanism for validating the contents of XML documents
A powerful alternative to older Document Type Definitions (DTDs)
XML based – reduces the need for yet another parser
Designed with namespaces in mind since the beginning
Extensive pre-defined simple types
Easy mechanism for creating new types
![Page 16: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/16.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I16 © 2003 IBM Corporation
<?xml version="1.0" encoding="UTF-8" ?><xsd:schema xmlns:xsd=http://www.w3.org/2001/XMLSchema>
<xsd:element name="BookStore"><xsd:complexType> <xsd:sequence> <xsd:element ref="Book" minOccurs="1" maxOccurs="unbounded" /> </xsd:sequence></xsd:complexType>
</xsd:element><xsd:element name="Book">
<xsd:complexType><xsd:sequence> <xsd:element name="Title" type="xsd:string" /> <xsd:element name="Author" type="xsd:string" /> <xsd:element name=“Published" type="xsd:date" /></xsd:sequence>
</xsd:complexType></xsd:element>
</xsd:schema>
XML Schema for a BookstoreDefine cardinality of elements
Create complex types out of a sequence of simple types
![Page 17: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/17.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I17 © 2003 IBM Corporation
XML Schema Builtin Datatypes
Numeric Data
Time Data
Textual Data
Binary Data
![Page 18: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/18.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I18 © 2003 IBM Corporation
Processing XML – Parsing Models
Pull parsing Application “pulls” from parser for next piece of information No standard API yet
Push parsing Parser “pushes” complete pieces of information read Application provides event-callback The Simple API for XML (SAX) is the de-facto standard
One-step parsing Read entire XML document and build an equivalent parsed tree The W3C Document Object Model (DOM) specification
Map XML objects to data structures used to build the parsed tree Very popular due to simplicity (compared with other methods) Not too efficient
Hybrid parsing Application thinks entire tree has been built (one-step parsing) Parser pulls data as needed (pull-parsing)
![Page 19: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/19.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I19 © 2003 IBM Corporation
Processing XML – SAX-based
import javax.xml.parsers.SAXParser;import javax.xml.parsers.SAXParserFactory;import org.xml.sax.Attributes;import org.xml.sax.SAXException;import org.xml.sax.helpers.DefaultHandler;
public class MySaxBasedApplication extends DefaultHandler {
public void processXML(InputStream XMLStream) { SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSAXParser(); parser.parse(XMLStream, this); }
public void startDocument() throws SAXException { // My code goes here . . . }
public void endDocument() throws SAXException { // My code goes here . . . }
Abstract class that defines all SAX callbackinterfaces
` Receive notification of end of a document
Receive notification of beginning of a document
Create the connection between our concrete handler and the SAX parser. Start parsing
![Page 20: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/20.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I20 © 2003 IBM Corporation
Processing XML – SAX-based (cont.)
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attrs) throws SAXException { // My code goes here . . . }
public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException { // My code goes here . . . }
public void characters(char buf[], int offset, int len) throws SAXException { // My code goes here . . . }
} // ENDOF: public class MySaxBasedApplication extends DefaultHandler
Receive notification of beginning of an element
Receive notification of end of an element
Receive notification of character data inside an element
![Page 21: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/21.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I21 © 2003 IBM Corporation
Processing XML – DOM-basedimport javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;import org.w3c.dom.NodeList;import org.w3c.dom.Document;import org.w3c.dom.Element;
public class MyDomBasedApplication { public void processXML(InputStream XMLStream) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parser(XMLStream); // My code goes here . . . // use DOM interfaces to manipulate the tree: Element e = doc.getDocumentElement(); if (e.hasAttribute(“an-attribute”)) { // do something with Element e } }} // ENDOF: public class MyDomBasedApplication
Parse the entire XML document into a DOM tree
Then use the DOM interfaces to manipulate the tree
![Page 22: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/22.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I22 © 2003 IBM Corporation
Processing XML – DOM-based (cont.)
![Page 23: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/23.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I23 © 2003 IBM Corporation
XML Summary
XML Namespaces Key tool for resolving the problems of name recognition and collision Fundamental for mixing information from multiple schemas into a
single document XML Schema
De facto standard for describing document structure and XML data types for data-oriented XML applications
Java APIs for XML processing org.xml.sax
Push parsing, fast but hard to use org.w3c.dom
One-step parsing, easy to use but inefficient
![Page 24: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/24.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I24 © 2003 IBM Corporation
The Simple Object Access Protocol (SOAP)
XML-based protocol for messaging and RPC
Can works on top of existing transports
HTTP, SMTP, FTP, MQSeries
Use of XML schema for encoding typed values
Language independent
Generation of SOAP messages available in popular programming
language
C, Java, Perl
![Page 25: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/25.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I25 © 2003 IBM Corporation
A SOAP Message
Envelope Mandatory root element of SOAP messages Contains an optional header and the message body
Header Primary extensibility mechanism Usually handled by intermediaries Typical uses: authentication, authorization, transaction management,
tracing, etc. One or more header entries or headers Arbitrary XML mustUnderstand attribute
Body One or more header body entries or bodies Arbitrary XML
![Page 26: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/26.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I26 © 2003 IBM Corporation
A SOAP Message - Example
<env:Envelope xmlns:env="http://www.w3.org/2002/06/soap-envelope">
<env:Header> <n:alertcontrol env:mustUnderstand="false“ xmlns:n="http://example.org/alertcontrol"> <n:priority>1</n:priority> <n:expires>2001-06-22T14:00:00-05:00</n:expires> </n:alertcontrol> </env:Header>
<env:Body> <m:alert xmlns:m="http://example.org/alert"> <m:msg>Pick up Mary at school at 2pm</m:msg> </m:alert> </env:Body>
</env:Envelope>
![Page 27: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/27.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I27 © 2003 IBM Corporation
Protocol packet
Service data
SOAP Envelope
Protocol packet
SOAP: XML Messaging
ApplicationApplication Web ServiceWeb Service
SOAP EngineSOAP Engine
Network ProtocolNetwork Protocol
SOAP EngineSOAP Engine
Network ProtocolNetwork Protocol
Request
Response
Application data
SOAP Envelope
Service Requestor Service Provider
![Page 28: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/28.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I28 © 2003 IBM Corporation
SOAP over HTTP
POST /StockQuoteProj/servlet/rpcrouter HTTP/1.0Host: localhost:9081Content-Type: text/xml; charset=utf-8Content-Length: 469SOAPAction: ""
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAPENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body> <ns1:getQuote xmlns:ns1=“http://tempuri.org/StockQuoteService”> <symbol xsi:type="xsd:string">IBM</symbol> </ns1:getQuote> </SOAP-ENV:Body></SOAP-ENV:Envelope>
The SOAP envelope as the HTTP payload
The HTTP header
![Page 29: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/29.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I29 © 2003 IBM Corporation
SOAP over SMTP
From: [email protected]: [email protected]: Travel to LADate: Thu, 29 Nov 2001 13:20:00 ESTMessage-Id: <[email protected]>
<?xml version='1.0' ?><env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope"> <env:Body> <p:itinerary xmlns:p="http://travelcompany.example.org/reservation/travel"> <p:departure> <p:departing>New York</p:departing> <p:departureDate>2003-05-25</p:departureDate> <p:departureTime>late afternoon</p:departureTime> </p:departure> <p:return> <p:departing>Los Angeles</p:departing> <p:departureDate>2003-05-30</p:departureDate> <p:departureTime>mid morning</p:departureTime> </p:return> </p:itinerary></env:Body></env:Envelope>
The SOAP envelope as the SMTP payload
The SMTP header
![Page 30: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/30.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I30 © 2003 IBM Corporation
SOAP Intermediaries
Vertical extensibility
Capability of adding new pieces of information within a SOAP message
Horizontal extensibility
Targeting different parts of a SOAP message to different recipients
Achieved through intermediaries that process parts of SOAP messages as they travel from source to destination
Security
Scalability
Tracing
SOAP headers can be explicitly targeted at intermediaries SOAP-ENV:actor attribute
http://schemas.xmlsoap.org/soap/actor/next
![Page 31: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/31.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I31 © 2003 IBM Corporation
Protocol packet
Service data
SOAP Envelope
Protocol packet
SOAP Intermediaries
ApplicationApplication Web ServiceWeb Service
SOAP EngineSOAP Engine
Network ProtocolNetwork Protocol
SOAP EngineSOAP Engine
Network ProtocolNetwork Protocol
Application data
SOAP Envelope
Service Requestor Service Provider
SOAP EngineSOAP Engine
Network ProtocolNetwork Protocol
SOAP Envelope
SOAP EngineSOAP Engine
Network ProtocolNetwork Protocol
SOAP Envelope
Actor 1 Actor 2
![Page 32: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/32.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I32 © 2003 IBM Corporation
SOAP Intermediaries – Example <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope"> <env:Header> <m:reservation xmlns:m="http://travelcompany.example.org/reservation" env:actor="http://www.w3.org/2001/12/soap-envelope/actor/next" env:mustUnderstand="true"> <m:reference>uuid:093a2da1-q345-739r-ba5d-pqff98fe8j7d</reference> </m:reservation> <n:passenger xmlns:n="http://mycompany.example.com/employees" env:actor="http://www.w3.org/2001/12/soap-envelope/actor/next" env:mustUnderstand="true"> <n:name>John Q. Public</n:name> </n:passenger> </env:Header> <env:Body> <p:itinerary xmlns:p="http://travelcompany.example.org/reservation/travel"> <p:departure> <p:departing>New York</p:departing><p:departureDate>2001-12-14</p:departureDate> </p:departure> <p:return> <p:departing>Los Angeles</p:departing><p:departureDate>2001-12-20</p:departureDate> </p:return> </p:itinerary></env:Body></env:Envelope>
The reservation system must keep an unique reference to the itinerary
The employees system must know who is traveling
![Page 33: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/33.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I33 © 2003 IBM Corporation
SOAP Error Handling
HTTP/1.0 500 Internal Server ErrorContent-Type: text/xml; charset=“utf-8”Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://www.w3.org/2001/12/soap-envelope” SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/enconding/”>
<SOAP-ENV:Body> <SOAP-ENV:Fault>
<faultcode>Client.AuthenticationFailure</faultcode><faultstring>Failed to authenticate client</faultstring><faultactor>where-the-problem-occurred</faultactor>
</SOAP-ENV:Fault> </SOAP-ENV:Body></SOAP-ENV:Envelope>
Transport Protocol Error indicationThe mandatory faultcode element: - VersionMismatch - MustUnderstand - Client - Server
Human readable message identifying cause of the problemWhere in the message path the error ocurred
![Page 34: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/34.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I34 © 2003 IBM Corporation
SOAP Data Encoding
How to encode complex data types that do not have a direct representation in
XML Schema
Arrays, arbitrary data structures
Explicitly specify encoding rules of the message or parts of it
The encodingStyle attribute
SOAP defined encoding rulesSOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding
No default encoding, i.e., this attribute is mandatory at least for the SOAP-ENV:Envelope element
Data encoding rules
Well defined mapping between abstract data models (ADM) and XML
syntax
![Page 35: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/35.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I35 © 2003 IBM Corporation
SOAP Data Encoding (cont.)
Simple types
Map to XML Schema built-in types
Compound types
Composed of several parts, each with an associated type
Parts are distinguished by an accesor Name or relative position of a part
Structs Compound types whose parts are distinguished only by their name
Arrays Compound types whose parts are distinguished only by their ordinal
position
![Page 36: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/36.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I36 © 2003 IBM Corporation
SOAP Data Encoding - Arrays
<element name=“arrayOfNumbers”> <complexType base=“SOAP-ENC:Array> <element name=“number” type=“xsd:int” maxOcurrs=“unbounded”/> </complexType></element>
<arrayOfNumbers SOAP-ENC:arrayType=“xsd:int[2]”> <number>11</number> <number>22</number></arrayOfNumbers>
<SOAP-ENC:Array SOAP-ENC:arrayType=“xsd:int[2]”> <SOAP-ENC:int>11</SOAP-ENC:int> <SOAP-ENC:int>22</SOAP-ENC:int></SOAP-ENC:Array>
Array encoding without schemaEncoding using the schemaSchema for an array of integers
![Page 37: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/37.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I37 © 2003 IBM Corporation
SOAP Data Encoding – Structured Data
Does the XML format on the wire matters ? No Use automatic “data to XML and back” encoding systems
SerializerSerializer
DeserializerDeserializerApp
licat
ion
Dat
aA
pplic
atio
n D
ata
XM
LX
ML
![Page 38: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/38.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I38 © 2003 IBM Corporation
codegen
SOAP Data Encoding – Structured Data
Does the XML format on the wire matters ? Yes Automatic generated XML might not be good enough
Delegate XML processing to application Build and register custom serializers/deserializers
Manually Use of schema compilers
SerializerSerializer
DeserializerDeserializerApp
licat
ion
Dat
aA
pplic
atio
n D
ata
XM
LX
ML
SchemaSchema Schema CompilerSchema Compiler
codegen
![Page 39: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/39.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I39 © 2003 IBM Corporation
Messaging versus RPC
Messaging Focus is data, which can be in any
conceivable format APIs
sendMessage(), getMessage(), registerMessageCallback()
In the WS contextCarry XML dataCould be one-way or request-
responseAsynchronous
Remote Procedure Call Focus is logic APIs:
Call(target, operation, params[]) In the WS context
Direct, synchronous, request-response invocationsPass data structures
![Page 40: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/40.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I40 © 2003 IBM Corporation
SOAP RPC
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAPENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body> <ns1:getQuote xmlns:ns1=“http://tempuri.org/StockQuoteService”>
<symbol xsi:type="xsd:string">IBM</symbol> </ns1:getQuote> </SOAP-ENV:Body></SOAP-ENV:Envelope>
Operation Parameter
![Page 41: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/41.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I41 © 2003 IBM Corporation
SOAP Messaging
<env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope"> <env:Body> <p:itinerary xmlns:p="http://travelcompany.example.org/reservation/travel"> <p:departure> <p:departing>New York</p:departing> <p:departureDate>2003-05-25</p:departureDate> <p:departureTime>late afternoon</p:departureTime> </p:departure> <p:return> <p:departing>Los Angeles</p:departing> <p:departureDate>2003-05-30</p:departureDate> <p:departureTime>mid morning</p:departureTime> </p:return> </p:itinerary></env:Body></env:Envelope>
![Page 42: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/42.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I42 © 2003 IBM Corporation
SOAP Summary
The flexible SOAP envelope
Vertical extensibility using SOAP headers
SOAP intermediaries
Horizontal extensibility
Encoding data using SOAP
SOAP for messaging and RPC applications
SOAP over multiple network protocols
![Page 43: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/43.jpg)
IBM Labs in Haifa
J2EE Technologies - Web Services I43 © 2003 IBM Corporation
Agenda
Web Services: What is it about
XML Primer
Simple Object Access Protocol – SOAP
Describing Web Services – WSDL
Discovering Web Services – UDDI
Web Services in the Marketplace
What is next
The Open Grid Services Architecture
![Page 44: IBM Labs in Haifa J2EE Technologies: Web Services I Benny Rochwerger Research Staff Member.](https://reader036.fdocuments.us/reader036/viewer/2022062407/56649d635503460f94a459d5/html5/thumbnails/44.jpg)
IBM Labs in Haifa
J2EE Technologies: Web Services I
Benny RochwergerResearch Staff Member