Download presentation
Presentation is loading. Please wait.
1
Application-to-application communication and Web services ISD3
2
Connecting Information Systems Application silos –Typically applications in a company are build with all three layers coupled together, perhaps with a web presentation layer Personnel (HR) Project Management (PM) Payroll Purchase Order processing –Application interactions PM needs access to staff details Job sheets are information about projects and payroll PM system generates and tracks purchase orders –Applications may be in different organisations: Purchase Order processing in company X To Order processing in supplier Company Y Service Oriented Architecture –Enabling the use of data and services in each application within and between organisations
3
Silos to SOA
4
Reuse In Information Systems reuse is about use of existing information and information services - objects, resources, standards; processes In Computer systems, reuse is about use of generic software components – classes, functions Hosted applications (Blogger, Flickr, 37Signals, Del.icio.us) is about reuse of entire applications
5
Two different Web architectural styles Web services with SOAP or other protocol REST with just URLs over HTTP Amazon's web services have both SOAP and REST interfaces, and 85% of the usage is on the REST interface. (He 2004)Amazon's web services
6
Creating a web service For the client: –Discovering an information service which provides the required information –Understanding the data quality supported. –Understanding the communication protocol –Writing the client and converting the information from the form it which it is provided to the form in which it will be used. For the server –Recognising a common service requirement –Establishing the right to disseminate the information. –Understanding the legacy system –Developing the service –Describing the interface to the service –Publishing the information –Gaining financial or other benefits from the service –Ensuring the security and reliability of the service
7
Web services in practice www.webservicex.net provides a range of free services. We will use a few of these in the workshop next week.www.webservicex.net Another collection of web services is Xmethods. Here there is also a simple interface to try a service.Xmethods Other web services will require a payment to use. Web services used within an organisation to provide a clean interface between information providers and information requirers. Web services can be put on top of legacy systems to enable integration of existing systems. Web services lead to a Service Oriented Architecture (SOA)
8
Mechanisms These are all variations of the simple interaction protocol – one request with parameters sent, one reply returned. The differences lie in – the underlying communications protocol used (these are all HTTP based) –in the way in which parameters are packaged for sending and reply.
9
Simple GET Interaction Request/Response pattern client server function Response Get Request (+ parameters)
10
Simple URL Client-side –Parameters passed using GET with a formatted reply –Parameters are send in name=value pairs, each value URL- encoded (space replaced by ‘+’, odd characters replaced by %hex value). –Limited data structuring available (but names can be repeated). –One or more parameters might be used to specify which operation to perform. operation=query means execute a query operation=update means add a record to the database. –The reply is a page whose structure is determined by the server. The client will be responsible for parsing the input to extract the information. This might range from a simple string to a complex XML document.
11
Simple URL Server-side –Script is invoked just as if it had been the target of a link on a page or a form. –In PHP the parameters themselves can be accessed by : $name (if the installation variable register_globals is set) $_GET[‘name’] or $_POST[‘name’]. –Reply can be any string whose structure is determined by the service application Testing and testing scripts are easy to set up. URLs can be –Bookmarked perhaps using del.icio.us –Stored in a database –Communicated e.g. if I want another lecturer to check on a programme structure, I email the URL with a comment (instead of giving her instructions about how to find this resource using a given navigational interface) POST, Frames, Flash, Java Applets all defeat simple URLS
12
Example The currency converter example was set up as a server. The SMS server is the client in this connection, the calculator script the server cursms.xql
13
Simple Interaction Request/Response pattern SMS server Currency script On $host cursms.xql convert text=100+USD+NZD&code=CUR8&from=4478678777 $message= CUR 100 USD NZD $from=4478678777 Reply: 100 US Dollars is 130 NZ Dollars $response = file(“$host?text=100+USD+NZD&code=CUR8&from=4478678777”); print $response; e.g. $host=“stocks.cems.uwe.ac.uk:8080/exist/servlet/ChrisWallace/calulator”
14
Page scraping HTTP get as before Server is unaware that the client is another application, not a browser. The information in the reply is contained in a normal web page Complex parsing of the result is required to dig out the required information. This ‘html-scrapping’ is common but there is no guarantee that the format of the page or its location will remain stable, so it’s a very risky approach. Parsing the html page and the data requires tricky programming using pattern-matching
15
XML responses Define a schema for the response Publicise this schema as part of the interface to the SMS server Return all replies as XML Program can use generic XML parser to read Send 100 US Dollars is 130 NZ Dollars
16
REST Representational State Transfer An architectural Style (or Pattern) whose name was suggested by Roy Fielding in 200 Key ideas –Every resource has a unique URI – Logical not Physical –Request uses HTTP GET with simple URI –Reply is an XML document, a summary of the resource, with links to related resources –State of interaction is held only by the Client Client can fetch further detail as the user selects links no need for session –Use HTTP operations (GET, POST, PUT, DELETE) to provide a CRUD interface to the information resources
17
Example : Modules and Programmes Request data about a module www.uwe.ac.uk/Module/UFIEKG-20-3 this may be re-written to become : www.uwe.ac.uk/fold/module.xql?code=UFIEKG-20-3 But this is transparent to the client, allowing changes in server implementation Receive XML document Information systems development 3 20 3 Reply is a summary of data, with links to related resources Client will present this and provide navigation
18
Server Need to decide on –the Resources to be provided Module Run –Collections can also be resources All Modules in a Field for a given Year –The granularity of the data Slow reveal, not everything at once –The schemas for the ‘representation’ Provide mapping (de-referencing) from URI to internal calls Provide access to the schemas themselves
19
Client Client may be –Running Server side, constructing a static HTML page for the end user –Running Client-side, with JavaScript code to unpack the XML and dynamically construct pages –End users obtain client code from the service provider –AJAX enables complex Client-side scripting
20
Example New site isbn.com –http://isbndb.com/http://isbndb.com/ –http://isbndb.com/data-intro.htmlhttp://isbndb.com/data-intro.html Create an account Create an access key http://isbndb.com/api/books.xml?access_key=TRE9KNJB&index1=isbn&valu e1=156592262X Response is - Java in a Nutshell Java in a Nutshell (The Java Series) David Flanagan, O'Reilly
21
REST sources wikipedia entry –http://en.wikipedia.org/wiki/Representational_State_Trans ferhttp://en.wikipedia.org/wiki/Representational_State_Trans fer Roger Costello –http://www.xfront.com/REST-Web-Services.htmlhttp://www.xfront.com/REST-Web-Services.html Roy Fielding’s PhD (2000)Roy Fielding’s –http://www.ics.uci.edu/~fielding/pubs/dissertation/top.ht mhttp://www.ics.uci.edu/~fielding/pubs/dissertation/top.ht m Hao He, 2004 Implementing REST Web Services: Best Practices and Guidelines –http://www.xml.com/pub/a/2004/08/11/rest.htmlhttp://www.xml.com/pub/a/2004/08/11/rest.html They are all here and may be updated (and a great Rest example): –http://del.icio.us/perdika/resthttp://del.icio.us/perdika/rest
22
Web services via SOAP Web services are a response to the problems of the simple URL based mechanism. –The main problem is the formatting of the sent and received data. If there was a standard way of formatting both, and a standard way of describing that format, life would be much easier. Web service interaction –an XML file sent using HTP POST –response is also an XML document –the client has to parse the returned XML document to discover what information has been provided. Parsing XML is not a simple task, but with the increased use of XML, it is a routine task, for which many packages already exist. PHP has built-in support for XML parsing. The convention for the structure of both the sent and returned data is called SOAP Simple Object Access Protocol). There also needs to be a way of describing the structure of both documents, there is a third use of XML – in the Web Service Definition Language WSDL.
23
Web services and PHP Creating a web service at a low level is a bit complicated but packages are available in most languages such as PHP, Perl and Java to simplify the task of writing a client or server. We can use a package for PHP called nusoap. It can be downloaded from here, and just needs to be unzipped into a suitable directory to use.. It is an open source project under Sourceforge. nusoap SOAP is included in PHP5 and the interface is slightly different, but this package works fine with PHP4.
24
ISBN application One of the free web services is a service to locate book details given the ISBN – International Standard Book Number 0-201-32563-2 is the ISBN for UML Distilled by Martin Fowler Run my simple clientRun
25
ISBN Web Service The interface is defined by the WDSL for this service.WDSL Service URI: www.webserviceX.NET/isbn.asmx Operation: GetISBNInformation Parameters: Code Output: An XML structure with fields for: AUTHOR FULLTITLE SHORTTITLE ISBN DATE SUBJSECT PUBLISHER
26
SOAP and Java Object-orientation is at the heart of all modern approaches to systems development – Java,.NET, Object- oriented databases… SOAP is object-oriented but it has a much simpler model than Java and other object oriented languages. The following slides contrast the two
27
Web services as information services WSDL defines (part of ) the formal interface But what defines the information quality of the service? –Which are books in the ISBN service – what’s the coverage of the service? –How current is the data? –How accurately has the data been collected? –Who is responsible for the content of the service? –What guarantees of service availability? –How stable is the defied interface?
28
Web Service Security issues Web services open up an application to the web and to malicious access –Accessing confidential data –Unauthorised interaction with a core system –Denial of service attacks Web2.0 is based on –sharing –trust
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.