Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Services. XML Namespaces, Schemas XML processing. Week 2.

Similar presentations


Presentation on theme: "Web Services. XML Namespaces, Schemas XML processing. Week 2."— Presentation transcript:

1 Web Services. XML Namespaces, Schemas XML processing. Week 2.

2 Remainder. First quiz will be given next Thursday (February 2, 2006)

3 Today's agenda. ● Summary from last lesson, ● XML namespaces, ● XML Schemas, ● XML processing.

4 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

5 “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)

6 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

7 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.

8 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).

9 Service Oriented Architecture (SOA) service registry service requesterservice provider PublishFind Bind

10 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...

11 Intro to XML syntax. viewing po.xml in a browser.

12 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

13 Namespaces Two problems with composed documents. Listing 2.6: Purchase order as part of a message.

14 Namespaces Recognition – applications can distinguish between elements originating from different documents. Collision – when element names from different documents clashes.

15 Namespace must be associated with a unique “Namespace”.

16 Namespaces, why? ● consider Listing 2.6 ● consider Listing 2.7

17 Namespaces URIs, are URLs are all unique strings. Example: http://www.xcommercemsg.com Associated resources not the point here!

18 Namespaces Namespace syntax: Example: http://www.xcommercemsg.comhttp://www.xcommercemsg.com /ns/message

19 Namespace Namespace declaration: xmlns : = “ ” Example : the attribute (Listing 2.7) xmlns:msg = “http://www.xcommercemsg.com/ns/message”

20 Namespaces Consider Listing 2.7 <msg:message from... xmlns:msg = “http://www.xcommercemsg.com/ns/message “http://www.xcommercemsg.com/ns/message xmlns:po= “http://www.skatestown.com/ns/po”>http://www.skatestown.com/ns/po...

21 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?

22 Namespaces Default namespace:: drop prefix in attribute. Example: drop “msg” in Listing 2.8 xmlns = “http://www.xcommerce.../ns/message.”

23 Namespace Adding attributes (“hints”) to the hybrid document:...the order-processing software should ignore them. Example: Listing 2.10. Solution: separate Namespace-prefixed attributes.

24 XML Schemas Meta-language for describing: ● the structure of an XML document, ● mapping XML syntax to types.

25 XML Schemas All specifications of web services uses XML schema.

26 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 125350 is of type int).

27 Basic XML schema structure <xsd:schema xmlns:xsd = “http://www.w3.org/2001/XMLSchema”...>... (see Listing 2.11)

28 XML Schema XML Primer: URL “http://www.w3.org/TR/xmlschema-0/”

29 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.


Download ppt "Web Services. XML Namespaces, Schemas XML processing. Week 2."

Similar presentations


Ads by Google