160 likes | 303 Views
EE557: Server-Side Development. Lecturer: David Molloy Room: XG19 Mondays 10am-1pm Notes: http://www.eeng.dcu.ie/~ee557 Mailing List: ee557@list. dcu.ie. EE557: Server-Side Development. Web Applications. Two types of web applications
E N D
EE557: Server-Side Development Lecturer: David Molloy Room: XG19 Mondays 10am-1pm Notes: http://www.eeng.dcu.ie/~ee557 Mailing List: ee557@list. dcu.ie
EE557: Server-Side Development Web Applications • Two types of web applications • Presentation-oriented: application generates interactive pages containing • various types of markup (XML, HTML etc.) and dynamic content in response • to requests -> we are familiar with this type • Service-oriented: Service-oriented web application implements the endpoint • of a web service. Frequently we used presentation-oriented applications • as clients to our service-oriented web applications
EE557: Server-Side Development Web Services • Services offered via the Web • Business application sends a request to a service at a given URL • using the SOAP protocol over HTTP • Service receives the request, processes it and returns a response • Example: A stock quote service • Request asks for the price of a specified stock, response gives back • the stock price and other information • Example: delivery system • Service that maps out the efficient delivery of goods. Business sends • a request containing the delivery destinations, service processes the • request to generate the most efficient route • Web Services most commonly used for B2B transactions, as opposed • to B2C transactions -> integrating business services
EE557: Server-Side Development Web Services • Web services depend on the ability of parties to communicate with • each other even if they are using different information systems • XML is a markup language that makes data portable and is the • key technology in addressing this need • This inter-system communication is handled using the SOAP • protocol • Figure 11.0 from notes (won’t copy/paste clearly)
EE557: Server-Side Development Simple Object Access Protocol • .NET and other technologies are based around SOAP • Simple protocol based on the idea that in a distributed architecture • you will need to exchange information • SOAP is lightweight, with a minimal amount of overhead • Occurs over HTTP, avoiding tricky issues such as firewalls and • non-typical sockets • Messages are packaged in a SOAP envelop and sent to the server • in a Request/Response fashion • SOAP unlike other protocols such as RMI does not require a strong • connection between the client and the server • Instead, SOAP allows services in alternative languages/platforms • to interoperate -> “incompatible systems”
EE557: Server-Side Development SOAP • SOAP message contains: • - Envelope: describes the message and how to process it • - Header: contains the features of the SOAP message • - Body: contains the primary information for the message receiver
EE557: Server-Side Development SOAP Message • Envelop is analogous to a snail mail envelope. It supplies information • which includes data relating to the recipient and the sender as well • as further detail about the message itself
EE557: Server-Side Development Features of SOAP • Uses standard internet HTTP • Uses XML to send and receive messages • Platform Independent • Language Independent • A protocol for exchanging information in a decentralised and • distributed environment
EE557: Server-Side Development Sample SOAP Message <SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema" > <SOAP-ENV:Body> <ns1:GetStockQuote xmlns:ns1="urn:xmethods-quotes"> <SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <symbol xsi:type="xsd:string">IBM</symbol> </ns1:GetStockQuote> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
EE557: Server-Side Development Sample SOAP Message <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetStockQuoteResponse xmlns:m="urn:xmethods-quotes"> <Price>34.5</Price> </m:GetStockQuoteResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
EE557: Server-Side Development SOAP • As stated previously, we need to know how to send and receive • SOAP messages • Therefore we use HTTP • Eg. Our first message • SOAPAction header indicates the ‘intent’ of a request and is • mandatory. Each SOAP server could have multiple functions and • the SOAPAction defines which function is being requested POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI“ ...the soap request packet here...
EE557: Server-Side Development SOAP • Similarly the SOAP response from the HTTP server might be: HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn ...Soap Response packet here...
EE557: Server-Side Development Java API for XML Web Services • JAX-WS is a Java API for building Web services and clients that • communicate using XML • Part of Java EE platform from Sun Microsystems • Implemented as part of project Glassfish • Glassfish is an open source Java EE application server from Sun • JAX-WS is the successor to JAX-RPC (Java API for XML-based RPC) • previously covered on this module • JAX-WS allows developers to develop SOAP based interoperable • and portable web services • Despite SOAP being complicated to manually implement, JAX-WS • hides this complexity from the application developer
EE557: Server-Side Development Web Services Description Language • WSDL is an XML file which describes what functionality a web service • provides and how to access these services • - What a service does? • - How the service is accessed? • - Where a service is located? • Take a look at a WSDL file • We will dynamically generate a WSDL file in our example Java API for XML Web Services • Calculator Web Service - Demonstrate
EE557: Server-Side Development Java API for XML Web Services • So why is this approach better than using Java RMI? • Similar effect using a proxy on the client
EE557: Server-Side Development Universal Description, Discovery & Integration • UDDI is an XML-based standard for describing, publishing and • finding web services • Online directory which gives businesses and organisations a standard • approach to describing their services, discovering other business • services and understanding the appropriate methods involved • Achieved via WSDL which is used to describe the interfaces of any • developed web services • Before UDDI there was no standard for discovering partner products • and services • Consider an example where we write a web service interface to • airline reservation systems. Travel agencies can use our web service • if we provide them the means to do so (WSDL)!