Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Web-based Systems | Misbhauddin

Similar presentations


Presentation on theme: "Advanced Web-based Systems | Misbhauddin"— Presentation transcript:

1 Advanced Web-based Systems | Misbhauddin
Web Services XML-RPC, SOAP Advanced Web-based Systems | Misbhauddin

2 Advanced Web-based Systems | Misbhauddin
PHP Scenario Web Server HTTP Request HTTP Response Client exec w/environ html PHP Compiler SQL Database SAME AS CGI <?php $con = mysqli_connect($host, $user, $pwd, $db); $query = “SELECT name FROM user”; $result = mysqli_query($con,$query); $name = mysqli_fetch_array($result)[0]; ?> <html> <head><title>Test PHP Page</title></head> <body> <h1>Welcome Mr. <?php echo $name; ?></h1> ……. Presentation + Business Logic Data (SQL) = All messed up Advanced Web-based Systems | Misbhauddin

3 RIA Scenario Business Logic Presentation & Visualization Data & Models
XMLHTTP Request QUERY_STRING Server-Side Technology JavaScript Business Logic XML Response XML Data Presentation & Visualization Web Server Update (HTML) SQL Data & Models Browser Database Advanced Web-based Systems | Misbhauddin

4 Components of Data Exchange
Two applications want to share data over the Internet Initiating Action: Things don’t happen without any reason. A triggering mechanism is needed. Automatic: started at a fixed time (chron job, feed exchange) User Initiated: form submission Data Format: Data needs to be stored and transferred in a format understood by both applications. Data Transfer Mechanism: Process to transfer the data over the internet Advanced Web-based Systems | Misbhauddin

5 Data Transfer Mechanism
Selecting a proper protocol and data interchange format to pass data between your app is one of the most important decisions to make during the development process Common and widely used protocols XML-RPC SOAP REST All of these protocols transport data over the HTTP protocol XML-RPC & SOAP are XML-based REST works both with JSON or XML Advanced Web-based Systems | Misbhauddin

6 Advanced Web-based Systems | Misbhauddin
Web Services Web services are web application components Unlike traditional client / server model (web server / web page system) Does not provide user with a GUI Share business logic, data and processes through a programmatic interface across a network The applications interface, not the users Client / Server Web Services Advanced Web-based Systems | Misbhauddin

7 Advanced Web-based Systems | Misbhauddin
Web Services Allow different applications from different sources to communicate with each other Are not tied to any one operating system or programming language Do not require the use of browsers or HTML Web services are sometimes called application services Advanced Web-based Systems | Misbhauddin

8 XML-RPC (Remote Procedure Calls)
A set of implementations that allow software running on disparate operating systems, running in different environments to make procedure calls over the Internet Remote procedure calling using HTTP as the transport and XML as the encoding <methodCall> <methodName>sample.sumAndDifference</methodName> <params> <param><value><int>5</int></value></param> <param><value><int>3</int></value></param> </params> </methodCall> Advanced Web-based Systems | Misbhauddin

9 Simple Object Access Protocol (SOAP)
SOAP relies exclusively on XML to provide messaging services The XML used to make requests and receive responses in SOAP can become extremely complex Technologies in SOAP WSDL - Web Services Description Language UDDI - Universal Description, Discovery and Integration Advanced Web-based Systems | Misbhauddin

10 Advanced Web-based Systems | Misbhauddin
SOAP Messaging protocol that allows programs that run on different operating systems Communicate using HTTP & XML Specifies how to encode HTTP Header and XML Data Advanced Web-based Systems | Misbhauddin

11 Advanced Web-based Systems | Misbhauddin
WSDL <definitions> <types> data type definitions </types> <message> definition of the data being communicated.... </message> <portType> set of operations...... </portType> <binding> protocol and data format specification.... </binding> </definitions> It is written in XML It is an XML document It is used to describe Web services It is also used to locate Web services Advanced Web-based Systems | Misbhauddin

12 WSDL - The <portType> Element
The <portType> element defines a web service, the operations that can be performed, and the messages that are involved. Types of operations Type Definition One-way The operation can receive a message but will not return a response Request-response The operation can receive a request and will return a response Solicit-response The operation can send a request and will wait for a response Notification The operation can send a message but will not wait for a response Advanced Web-based Systems | Misbhauddin

13 WSDL One-Way Operation
<message name="newTermValues">   <part name="term" type="xs:string"/>   <part name="value" type="xs:string"/> </message> <portType name="glossaryTerms">   <operation name="setTerm">     <input name="newTerm" message="newTermValues"/>   </operation> </portType > glossaryTerms is a function library, ”setTerm" is a function with “newTermValues " as the input parameter Advanced Web-based Systems | Misbhauddin

14 WSDL Request-Response Operation
<message name="getTermRequest">   <part name="term" type="xs:string"/> </message> <message name="getTermResponse">   <part name="value" type="xs:string"/> <portType name="glossaryTerms">   <operation name="getTerm">     <input message="getTermRequest"/>     <output message="getTermResponse"/>   </operation> </portType> glossaryTerms is a function library, "getTerm" is a function with "getTermRequest" as the input parameter, and getTermResponse as the return parameter Advanced Web-based Systems | Misbhauddin

15 Advanced Web-based Systems | Misbhauddin
WSDL Binding Element binding element has two attributes - name and type Defines name of the binding Points to the port for the binding <binding type="glossaryTerms" name="b1">    <soap:binding style="document"    transport=" />    <operation>      <soap:operation soapAction="      <input><soap:body use="literal"/></input>      <output><soap:body use="literal"/></output>   </operation> </binding> soap:binding element has two attributes - style and transport style attribute can be "rpc" or "document transport attribute defines the SOAP protocol to use operation element defines each operation that the portType exposes must also specify how the input and output are encoded Advanced Web-based Systems | Misbhauddin

16 Advanced Web-based Systems | Misbhauddin
Is a directory service where businesses can register and search for Web services Discover the right business from the millions currently online Reaching new customers and increasing access to current customers Solving customer-driven need to remove barriers Describing services and business processes programmatically in a single, open, and secure environment Register UDDI Saudi Airlines Ticket Rate Find Airline Interface Travel Agencies Fly Dubai Register Advanced Web-based Systems | Misbhauddin

17 Advanced Web-based Systems | Misbhauddin
SOAP Building Blocks A SOAP message is an ordinary XML document containing the following elements: An Envelope element that identifies the XML document as a SOAP message A Header element that contains header information A Body element that contains call and response information A Fault element containing errors and status information <?xml version="1.0"?> <soap:Envelope xmlns:soap= soap:encodingStyle=" <soap:Header> ... </soap:Header> <soap:Body>    <soap:Fault> ... </soap:Fault> </soap:Body> </soap:Envelope> Advanced Web-based Systems | Misbhauddin

18 Advanced Web-based Systems | Misbhauddin
SOAP Envelope Element It is a required element It is the root element of a SOAP message It defines the XML document as a SOAP message Namespace Defines the Envelope as a SOAP Envelope Same as <!DOCTYPE html> <?xml version="1.0"?> <soap:Envelope xmlns:soap= soap:encodingStyle=" </soap:Envelope> Encoding Style Defines the data types used in the document Included as a URI Advanced Web-based Systems | Misbhauddin

19 Advanced Web-based Systems | Misbhauddin
SOAP Header Element It is an optional element Flexible framework for specifying additional application-level requirements <?xml version="1.0"?> <soap:Envelope> <soap:Header> <t:Transaction xmlns:t=" soap:mustUnderstand="true">5 </t:Transaction> </soap:Header> </soap:Envelope> mustUnderstand optional or mandatory Must process or ignore Advanced Web-based Systems | Misbhauddin

20 Advanced Web-based Systems | Misbhauddin
SOAP Body Element Contains the actual SOAP message Request <soap:Body>   <m:GetPrice xmlns:m="     <m:Item>Apples</m:Item>   </m:GetPrice> </soap:Body> <soap:Body> <m:GetPriceResponse xmlns:m=" <m:Price>1.90</m:Price> </m:GetPriceResponse> </soap:Body> Response Advanced Web-based Systems | Misbhauddin

21 Advanced Web-based Systems | Misbhauddin
SOAP Fault Element It is an optional element Contains the fault message in case an error occurred during processing Returned to the sender Sub-Element Description <faultCode> Text code used to indicate a class of errors <faultString> Text message explaining the error <faultActor> Text string indicating who caused the fault <detail> Element used to carry application-specific error messages Fault Codes VersionMismatch - Invalid namespace for the SOAP Envelope element MustUnderstand – Could not understand because attribute was set Server - Message was incorrectly formed or contained incorrect information Client - Problem with the server, so the message could not proceed Advanced Web-based Systems | Misbhauddin

22 Advanced Web-based Systems | Misbhauddin
SOAP Fault Element <?xml version="1.0"?> <soap:Envelope> <soap:Fault> <faultcode xsi:type="xsd:string">soap:Client</faultcode> <faultstring xsi:type="xsd:string"> Failed to locate method (ValidateCreditCard) in class (examplesCreditCard) at /usr/local/ActivePerl- 5.6/lib/site_perl/5.6.0/SOAP/Lite.pm line 1555. </faultstring> </soap:Fault> </soap:Envelope> Advanced Web-based Systems | Misbhauddin

23 Advanced Web-based Systems | Misbhauddin
Example WSDL <message name="getPriceRequest"> <part name="Item" type="xs:string"/> </message> <message name="getPriceResponse"> <part name="Price" type="xs:double"/> <portType name="glossaryPrice"> <operation name="getPrice"> <input message="getPriceRequest"/> <output message="getPriceResponse"/> </operation> </portType> <binding type="glossaryTerms" name="b1"> <soap:binding style="document" transport=" /> <operation> <soap:operation soapAction=" "/> <input><soap:body use="literal"/></input> <output><soap:body use="literal"/></output> </binding> Advanced Web-based Systems | Misbhauddin

24 Advanced Web-based Systems | Misbhauddin
SOAP Advantages Disadvantages Platform and language independent Simplified communication through proxies and firewalls Work with different transport protocols – HTTP, SMTP …. Slower than other protocols Uses verbose XML Not used for event notifications Firewall latency Different level of support based on the programming language (PHP, JAVA, Python, .Net) Advanced Web-based Systems | Misbhauddin


Download ppt "Advanced Web-based Systems | Misbhauddin"

Similar presentations


Ads by Google