Download
slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Web services @ work PowerPoint Presentation
Download Presentation
Web services @ work

Web services @ work

167 Views Download Presentation
Download Presentation

Web services @ work

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Web services @ work

  2. Agenda • Everything about web services • SOAP • WSDL • UDDI • Questions • Case Study

  3. What are Web Services ? • Services offered over the network. Weather Service Stock Quote Service Inventory Information

  4. Who should create web services? • Existing Computing Services • Existing Data storage Services • Existing Search Services • Existing Informational Services • And….. • Everybody who want to leverage existing functionality and offer the same to whole world.

  5. Typical web services architecture

  6. Enabling existing services Clients Internet HTTP Server (Apache, Tomcat, IIS) SMTP Server Agents Application Server (Axis) Engine (Axis) ServiceWrapper New ServiceImplementation Legacy System

  7. Who consumes web services ? • Integrators • Support utilities • CRM Software

  8. How to create web service • Be Guided by following standards • XML • SOAP • UDDI • HTTP (or any standard protocol) You can turn any existing functionality into web service, by adhering to above standards

  9. Web services related Standards • SOAP 1.2 • UDDI 1.3 • WSDL 1.2 • HTTP 1.1 • These are set by standards body like W3C,OASIS.

  10. Major development platforms • Microsoft’s .NET • Sun’s Web Services API • IBM’s Websphere

  11. When not to use web services • Performance requirements • Security and reliability • No reuse requirements • Lack of Web services support • Organizational or technical alignment

  12. Simple Object Access Protocol1.2

  13. Goal • Access objects and services on remote servers in platform independent manner

  14. AGENDA • What is SOAP • What is NOT SOAP • Why SOAP • SOAP Message Details

  15. Web Services Technologies UDDI Registry WSDL Points to description Points to service Describes Service Finds Service Service Consumer Web Service SOAP Communicates with XML Messages

  16. What is SOAP • Simple Object Access Protocol • Lightweight protocol for exchanging structural information • Uses XML Technologies • Independent of any platform/technology • Simple and Extensible

  17. What is NOT SOAP • A full-fledged distributed object system with support for • Objects-by-reference • Activation • Message batching • Distributed garbage collection • Naming and directory services • SOAP sacrifices these features for platform-neutrality and extensibility

  18. Typical SOAP message • <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" > • <soap:Header> • <!-- header element(s) here --> • </soap:Header> • <soap:Body> • <!-- body element(s) here --> • </soap:Body> • </soap:Envelope>

  19. Example SOAP Message • <?xml version="1.0" encoding="UTF-8"?> • <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" • xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> • <SOAP-ENV:Body> • <ns1:echoString xmlns:ns1="http://soapinterop.org/"> • <testParam xsi:type="xsd:string">Hello!</testParam> • </ns1:echoString> • </SOAP-ENV:Body> • </SOAP-ENV:Envelope>

  20. SOAP Messaging Model Communication protocol SOAP Sender SOAP Receiver Envelope SOAP Message xml

  21. SOAP Client Server internals

  22. Typical soap request over HTTP POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI" <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:GetLastTradePrice xmlns:m="Some-URI"> <symbol>DIS</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  23. Typical soap response over HTTP HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn <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:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>34.5</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  24. SOAP Message Structure

  25. SOAP Players Initial SOAPSender SOAP Intermediary SOAP Intermediary Ultimate SOAPReceiver SMTP MSMQ HTTP SOAP Message Path

  26. RPC and Document Styles Document RPC • Procedure Call • Synchronous • Marshalling and Unmarshalling parameters between Java Objects and XML • For simple point to point sync call Document-driven Asynchronous and synchronous Used when data is large and fluid

  27. RPC Style SOAP Message • <soapenv:Envelopexmlns:soapenv="soap_ns"xmlns:xsd="xml_schema_ns"xmlns:xsi="type_ns"><soapenv:Body> <ns1:getStockPrice xmlns:ns1="app_ns" soapenv:encodingStyle="encoding_ns"> <stockSymbol xsi:type="xsd:string"> • AAPL • </stockSymbol> </ns1:getStockPrice></soapenv:Body></soapenv:Envelope>

  28. Document Style SOAP Message • <soapenv:Envelopexmlns:soapenv="soap_ns"xmlns:xsd="xml_schema_ns"xmlns:xsi="type_ns"><soapenv:Body><ns1:customerOrdersoapenv:encodingStyle="encoding_ns"xmlns:ns1="app_ns"><order> <customer> <name>Plastic Pens, Inc.</name> <address> <street>123 Yukon Drive</street> <city>Phoenix</city> <state>AZ</state> <zip>85021</zip> </address> </customer> <orderInfo> <item> <partNumber>563</partNumber> <description>Red stappler</description> <quantity>30</quantity> <item> </orderInfo></order></ns1:customerOrder></soapenv:Body></soapenv:Envelope>

  29. Processing SOAP Message • SOAP HEADER Block and Node • Supports Multiple Message Exchange Patterns • One Way • Request/Response • Peer to Peer • Each Message is independently Processed • Roles for Node • next • none • ultimatereceiver

  30. What happens when message arrives • Node determines set of roles in which it needs to act on message • Identify all the header blocks targeted for the Node • If header block is not understood, generate fault and no further processing is done. • Process mandatory SOAP HEADER block • Process BODY if Node is ultimate receiver • Relay message if Node is playing intermediary role.

  31. SOAP Extensibility • SOAP Processing Model • SOAP Binding Framework • Formal set of rules for carrying soap message over underlying protocol. • HTTP Binding

  32. SOAP EncodingStyle • http://www.w3.org/2001/12/soap-encoding • To define data types used in the document <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> ... Message information goes here ... </soap:Envelope>

  33. SOAP RPC Representation • Method Invocation modeled as single struct • Struct is name identical to method • Parameter has the same name and order • Method Response is also modeled as struct

  34. Supported String int/Integer decimal float/Float double/Double date boolean/Boolean Long/Long Short/Short Byte/Byte hex Not Supported BigDecimal Other ? Data Types

  35. Where can FAULT Occur • Client • Server • Protocol

  36. Example FAULT Message in HTTP • HTTP/1.1 500 Internal Server Error • Content-Type: text/xml; charset="utf-8" • Content-Length: nnnn • <SOAP-ENV:Envelope • xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> • <SOAP-ENV:Body> • <SOAP-ENV:Fault> • <faultcode>SOAP-ENV:Server</faultcode> • <faultstring>Server Error</faultstring> • <detail> • <e:myfaultdetails xmlns:e="Some-URI"> • <message> • My application didn't work • </message> • <errorcode> • 1001 • </errorcode> • </e:myfaultdetails> • </detail> • </SOAP-ENV:Fault> • </SOAP-ENV:Body> • </SOAP-ENV:Envelope>

  37. Do I have to write all that xml?

  38. Basic Web Services use SOAP Brokerage Application Accounting Application Trader Application Buy 500 shares MSFT @$40/share ID=Bob Debit $20000 ID=Bob SOAP Sender SOAP Receiver/ Sender SOAP Receiver Confirm Debit $20000 Bought 500 shares MSFT @$40/share

  39. SOAP-less web service?

  40. Apache SOAP Architecture

  41. SOAP : Performance

  42. SOAP - Namespaces

  43. SOAP-interoperability • Following things must happen • The ability for the server to parse the client's SOAP envelope. • The ability for the server to deserialize the encoded parameter contained within the envelope • The ability for the client to parse the SOAP envelope sent by the server in response • The ability for the client to deserialize the encoded parameter sent back from the server. • Main concerns • SOAP Specification follow up • Data type • Precision support for float/decimal, date time, Arrays

  44. Food for thought • Scenario where soap intermediary is needed • How much payload of minimal SOAP Packet. • Do you really need SOAP for web services? • SOAP Over JMS? • SOAP and Performance? • SOAP slower than XML-RPC by almost 8 times !!

  45. References • http://www.w3.org/TR/SOAP/ • http://msdn.microsoft.com/library/ • http://www.soapuser.com • http://xml.apache.org/soap/ • http://www.xmethods.com

  46. What Next • WS-Security • WS-Policy • WS-Trust • WS-Federation • …….

  47. Questions

  48. WSDL Web Services Description Language

  49. Agenda • What is WSDL • Why WSDL • WSDL Structure • Usage • Consumers of WSDL • Questions

  50. Your business for others… • You need grammar to describe what your business do. Grammar should address .. • What services are offered by you • How can others invoke a service • What information your service needs • How user will provide information • What information you can provide • What format you expect WSDL is the answer