<<

Advanced topic 1: Web services; XHTML Contents

• Webservices • XML • XHTML Web services

• A – Service Oriented Architecture of W3C – a software system designed to support interoperable -to-machine interaction over a network. • Web services – Are services hosted by a machine and accessible over networks through an (frequently) API , – Its interface ( API ) description is usually described in WSDL • WSDL: Web Services Description Language - an XML format. – Interact with othet system using SOAP request, response messages following the WSDL description • SOAP: Simple Object Access Protocol – SOAP-messages typically conveyed using HTTP with an XML • Similar approaches – CORBA of OMG, 's DCOM or Sun's RMI. Web services- example of working schema Why Web services

• Interoperability has Highest Priority – Webservice use widely available transport protocol in different systems  different platforms could interact. – Web-applications follows standards  can be used by any browser on any platform. • Web Services take Web-applications to the Next Level – Web services allows to publish its function or message to the rest of the world. – Web services use XML to code and to decode data, and SOAP to transport it (using open protocols). • Web Services have Two Types of Uses – Reusable application-components. • Web services can offer application-components like: currency conversion, weather reports, or even language translation as services for being used by other applications. – Connect existing software. • Web services allows exchanging data between different applications and different platforms through HTTP. Big Web service

• "Big Web Services" – use XML messages that follow the SOAP standard – description of the offered operations is written in WSDL. – WSDL is a prerequisite for automated client-side code generation in many Java and .NET SOAP frameworks – Some organizations, such as the WS-I, mandate both SOAP and WSDL in their definition of a Web service. WSDL

• Define interface – Method  operation – Messages, – protocol, – End point  port • The supported operations of a Web Service together are called port types. • Contain many elements • tempconvert.wsdl WSDL elements

• WSDL elements are equivalent of a XML tag • Definitions – root element and contains the default namespaces for the WSDL document. • Types – defines the data types to be used in the Web Service. • message – describles the data to be exchanged on the network. • portType – Specifies the set of operations for a port . – The port address are assigned dynamically, which makes them reusable. • binding – describes the protocol and data format for portType. – Port type binds the messages and operations to a protocol and data format . – Binding refers to a way for the operations to access the service using a certain protocol. • Service – refers to a collection of related endpoints or ports . – A port is an a network address of the service – A web service is a set of resuable ports. SOAP SOAP

• Simple Object Access Protocol. • A lightweight and XML- protocol for exchanging information in a distributed enviroment. • Provide a well-defined XML packet for transmitting safely over any network through through standard protocols such as HTTP, SMTP. • SOAP specifies how to invoke remote objects in a sercured manner • Widely used in invoking Web Services. SOAP life cycle SOAP message architecture

• A SOAP Message contains – An Envelope : wrapped in any transport protocol such as HTTP – an optional Header: can include authentification detail – and the SOAP Body containing • In request message: request parameters • In response message: return values SOAP message UDDI

• Universal Description, Discovery and Integration • A Registry of services • Allows to provider publish services • Allows to consommer discovered and locate service Life cycle of Webservice

• WS provide service interface instead of user interface • Service Interface provides major role in life cycle • The service interface is an XML document that is used to call the Web Service. Restful Webservice

• REpresentational State Transfer (RESTful) Web services – A stateless client-server architecture in which the web services are viewed as resources and can be identified by their URLs – Become popular, particularly with Internet companies. – Using the PUT, GET and DELETE HTTP methods, alongside POST, which are often better integrated with HTTP and web browsers than SOAP-based services. – Do not require XML messages or WSDL service-API definitions. XML

• XML = Extensible Markup Language • XML is also a text-based markup language. • XML was designed to describe data. • XML tags are not predefined. You must define your own tags • XML uses a Document Type Definition (DTD) or an XML Schema to describe the data • XML with a DTD or XML Schema is designed to be self-descriptive • XML uses UTF-8 and UTF-16 which are acceptable by most software and hardware platforms  XML provides a global platform for communication amongst heterogeneous applications. XML document structure XML structure

• Document prolog contains metadata and consists of two parts – XML Declaration – Document Type Declaration (DTD). • DTD defines entities or attributes values and check grammar and vocabulary of markup. • Root Element (Document Element) – contain all the other elements and content in the document. Well-formed / Valided XML document • Well formed  follows standard easy for automated processing • The XML specification defines an XML document as a text which is well-formed , i.e., it satisfies a list of syntax rules provided in the specification – It contains only properly-encoded legal Unicode characters. – None of the special syntax characters. – Tags are correctly nested. – There is a single "root" element. –… • An XML document may be valid . – it contains a reference to a DTD, – Its elements and attributes are declared in that DTD and follow the grammatical rules specified in the DTD. XHTML

• XHTML = Extensible Hypertext Markup Language, is a markup language that has the same depth of expression as HTML, but also conforms to XML syntax. • A reformulation of HTML in XML • Need to be well-formed  true XHTML documents allow for automated processing to be performed using standard XML tools – unlike HTML, which requires a relatively complex, lenient, and generally custom parser. • XHTML allows define new elements easier than HTML • XHTML became a W3C Recommendation Advantage of XHTML

• XHTML makes HTML: – Compatibility with common XML tools; • Document can be automated processing  servers and proxies would be able to transform content, for constrained devices such as mobile phones. – Extensibility • By utilizing namespaces, XHTML documents could include fragments from other XML-based languages such as (SVG) and MathML. – Reusability • Opportunity to divide HTML into reusable components (XHTML Modularization) and clean up untidy parts of the language. Root element of XHTML document

• Root element must be , and contain an xmlns attribute to associate it with the XHTML namespace – xml:lang="en"> • For XHTML 1.1 and 2.0 an optional schemaLocation attribute can be added, to associate the namespace with an XML Schema. – Multiple naming space is allowed xmlns:xsi declaration indicates that any elements or attributes prefixed with xsi: fall within the XML Schema namespace