Webservices

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Webservices - Presentation Transcript

    1. Web Services The Next Generation Web Technology
    2. Contents
      • Overview
      • What are web services
      • What are the uses of web services
      • How they implement
      • Basics of SOAP and XML
      • Why use PHP
      • One sample application
    3. Overview
      • In a Normal web surfing scenario, a visitor visits a website and use the functionality provided by that particular website. User sends HTTP request to server from web browsers and server taken user’s request, processed and send response back to the user through browser. This is the process of website surfing by end user. Ex: www.inkakinada.com will provide lot of services to the end users like movies, news, jobs etc., information.
    4. Overview
      • Here, we cant get the www.inkakinada.com services by visiting www.nyros.com . Am I right? But it is also possible with web services, the name it self gives the meaning. Services provided by web. What exactly means You don’t need to visit the particular website to use their service and functionality if they are providing web services
      • So Web services are used to share the resource among the websites.
    5. What are web services?
      • Web services are the set of platform independent exposed functions which can be used to share logic (or data) across many websites, platforms and hardware configurations.
      • Hence web services are platform independent and language independent. Means JAVA web services can be used PHP Developers and vice versa.
      • There are two parties involved in web services, one is web service provider and other called web service consumer.
    6. Uses of web services?
      • Exposing your existing functionality through out the web with no cost
      • Retrieve information dynamically over the web
      • Connecting Different Applications i.e Interoperability
      • No Cost for communication
    7. How they implement?
      • There are different methods available for developing web services but below three are the most common methods
      • SOAP
      • XML–RPC
      • REST
      • SOAP is the best choice for PHP Developers to develop Web services
    8. SOAP
      • SOAP is the acronym of Simple Object Access Protocol. It is a transport protocol for the client request to the web service and response to the client from web service.
      • Web services uses the language XML to encode and decode your data and used the transport protocol SOAP to transport xml data between client and server.
      • Nusoap is the toolkit of PHP for providing and consuming web services using SOAP in PHP .
    9. XML
      • Web services send and receive data in the form of Extensible Markup Language (XML), which travel via Simple Object Access Protocol (SOAP).
      • XML [Extensible markup language] is a language which can be used for share information between different applications irrespective of platforms [windows / Linux etc] and languages [JAVA / PHP / .NET / ROR etc]. Hence XML is platform independent and language independent.
    10. Why use PHP
      • Already a very popular for web development
      • XML support
      • CURL support
      • OOP
      • SOAP extension etc.,
      • Lot of important tools available freely
    11. Sample Application
      • Here we implement one sample application which provides STD code for the city.
      • Assume one website which contains all the cities zip codes.
      • So he would like to provide this resources through out the web to the people who wants to find zip codes for the cities.
      • First he create one web service in his website.
    12. Code for creating service
      • include("nusoap.php");
      • include("dbconfig.php");
      • $server = new soap_server();
      • $server->register("getSTD");
      • function getSTD($city)
      • {
      • $query="select * from cities where cityname=$city";
      • $res=mysql_query($query);
      • $rs=mysql_fetch_assoc($res);
      • $output=$rs['std_code'];
      • return array("data"=>"$output ");
      • }
      • Here $ output will have the STD code for the city passed as
      • parameter......
    13. Code for Calling Service
      • include("nusoap.php");
      • $soap = new soapclient_nusoap("http://example.com/webservice.php");
      • $args = array('city'=>'kakinada');
      • $output = $soap->call("getSTD",$args);
      • print_r($output);//it gives output as array
    14. What is missing?
      • What happened
      • If you don't pass a City name?
      • If you don’t pass currect city name
      • If the database doesn’t contain result with the city name you passed even it is correct
      • SOAP Fault generation is the solution
    15. SOAP FAULT
      • Just change you service code
      • include("nusoap.php");
      • include("dbconfig.php");
      • $server = new soap_server();
      • $server->register("getSTD");
      • function getSTD($city)
      • {
      • $query="select * from cities where cityname=$city";
      • $res=mysql_query($query);
      • $rs=mysql_fetch_assoc($res);
      • $output=$rs['std_code'];
      • If($city==‘’ OR $output==‘’){return new soap_fault(‘Must supply valid city name’) }
      • else { return array("data"=>"$output "); }
      • }
    16. SOAP Work Here
      • Soap transfer the request and response very securely.
      • Soap packed the message securely and called it as soap envelop which contains 3 parts as below
      • 1. Soap header, 2. Soap body, 3. Soap fault
      • Soap header will contain any additional information to be send along with method call, like authentication information, security info etc, soap body will contain actual web service method call information with necessary parameters or result of method execution soap fault will contain error info
    17. Alternate Methods
      • XML-RPC [Remote Procedure Call]
      • Another way of providing and consuming web services. It uses XML to encode and decode the remote procedure call along with it’s parameter. You can visit the official website www.xmlrpc.com to know more about XML-RPC.
      • REST
      • Representational State Trasfer(REST) is comparatively simpler method for providing and consuming web services. It is not necessary to use XML as a data interchange format in REST. To know more about REST visit http://www.crummy.com/writing/RESTful-Web-Services/
    18. Soap References
      • SOAP and web services reference sites:
      • http://www.xml.com/pub/a/2001/04/04/webservices/
      • http://www.w3c.org/tr/soap
      • http://www.w3schools.com/SOAP/soap_intro.asp
    19. XML References
      • http://www.w3schools.com/xml/default.asp
      • http://www.w3.org/XML/
      • http://www.xml.com/
      • http://www.xml.org/
    20. GOOD LUCK
    SlideShare Zeitgeist 2009

    + Nyros TechnologiesNyros Technologies Nominate

    custom

    441 views, 0 favs, 4 embeds more stats

    Seminar presentation on Webservices by venkateswara more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 441
      • 428 on SlideShare
      • 13 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 14
    Most viewed embeds
    • 7 views on http://www.developers-blog.com
    • 4 views on http://java-jase.blogspot.com
    • 1 views on http://www.sisiraucsc.blogspot.com
    • 1 views on http://sisiraucsc.blogspot.com

    more

    All embeds
    • 7 views on http://www.developers-blog.com
    • 4 views on http://java-jase.blogspot.com
    • 1 views on http://www.sisiraucsc.blogspot.com
    • 1 views on http://sisiraucsc.blogspot.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories