Web Services. XML Namespaces, Schemas XML processing. Week 2.
Remainder. First quiz will be given next Thursday (February 2, 2006)
Today's agenda. ● Summary from last lesson, ● XML namespaces, ● XML Schemas, ● XML processing.
What is a web service? ● Collection of specific operations described by standardized Interface, ● flex. communication, ● network connected Application 2 Application communication ● Open standards based technologies. requester web service Registry Find Bind publish
“A software system designed to support interoperable machine-to-machine interactions over a network” Interface: “WSDL” Message format: “SOAP” Payload: “XML” (web service standards: OASIS) Web service definition World Wide Web Consortium (W3C)
Interoperability Stack BPEL4WS, WS-Notification WS-Security,WS-ReliableMessaging, WS-Transactions,WS-RessourceLifeTime XML, SOAP, WS-Addressing HTTP, HTTPS, SMTP, etc. WSDL, WS-Policy, UDDI, WS-ResourceProperties Compositional Quality of Experience Description Messaging Transports
Comparison with traditional Client-Server architectures ● CLIENT-SERVER: ● Communication is always: REQUEST- RESPONSE. ● Server is always passive. ● Typically RPC calls. ● Simple parameter transfer mechanism. ● WEB SERVICES: ● Communication may be one of three forms: request- response, server notification, client notification. ● server may be active, may call other applications ● structured data transfer.
Service Oriented Architectures ● All software components are modeled as services. ● Focus of service design is on the Service Interface, ● Application design in a distributed environment becomes about composing services, invoked over the network. ● Applications are integrated at the Interface level. ● Allows for loose coupling (may shift service dynamically).
Service Oriented Architecture (SOA) service registry service requesterservice provider PublishFind Bind
eXtensible Markup Language (XML) ● Representing strictly structured and semi- structured information in textual form. ● Standard (of World Wide Web Consortium, w3c.org). ● Used by all key web service technologies. ● The format for message payloads between web service requester and web service provider. ● In practice, all xml documents for web services are strictly-structured...
Intro to XML syntax. viewing po.xml in a browser.
XML's five commandments ● Tag names are case-sensitive ● Every opening tag must have a corresponding closing tag (unless it is abbreviated as an empty tag) ● A nested pair tag cannot overlap another tag pair ● Attribute values must appear within quotes ● Every document must have a root element
Namespaces Two problems with composed documents. Listing 2.6: Purchase order as part of a message.
Namespaces Recognition – applications can distinguish between elements originating from different documents. Collision – when element names from different documents clashes.
Namespace must be associated with a unique “Namespace”.
Namespaces, why? ● consider Listing 2.6 ● consider Listing 2.7
Namespaces URIs, are URLs are all unique strings. Example: Associated resources not the point here!
Namespaces Namespace syntax: Example: /ns/message
Namespace Namespace declaration: xmlns : = “ ” Example : the attribute (Listing 2.7) xmlns:msg = “
Namespaces Consider Listing 2.7 <msg:message from... xmlns:msg = “ “ xmlns:po= “
Namespaces Namespaces are scoped:...an element belongs to the namespace of its parent, unless explicitly bound by a local namespace. Example: Consider Listing 2.9 There is an error – what is wrong?
Namespaces Default namespace:: drop prefix in attribute. Example: drop “msg” in Listing 2.8 xmlns = “
Namespace Adding attributes (“hints”) to the hybrid document:...the order-processing software should ignore them. Example: Listing Solution: separate Namespace-prefixed attributes.
XML Schemas Meta-language for describing: ● the structure of an XML document, ● mapping XML syntax to types.
XML Schemas All specifications of web services uses XML schema.
XML Schemas ● Well-formed document. No XML syntax errors (mismatched start/end tags, invalid character data, etc.). ● Valid document. Having the correct format wrt. a specific kind of documents (must begin with a specific element, followed by specific attributes, etc.) Attribute content having the correct types (id = “125350” correct since is of type int).
Basic XML schema structure <xsd:schema xmlns:xsd = “ (see Listing 2.11)
XML Schema XML Primer: URL “
See you next week. ● Remember to prepare for the quiz. ● p 1-63, p78-90 ● Finish your homework. ● Lecture on rest of chap. 2, start chap 3.