Web Services In Php

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

    2 Favorites

    Web Services In Php - Presentation Transcript

    1. PHP – Web Service using NuSOAP Harit Kothari [email_address]
    2. Agenda
      • NuSOAP
      • Setting up & running Web Service in 5 minutes
      • An example
    3. NuSOAP
      • PHP library classes
      • Rewritten version of SOAPx4
      • Create & consume SOAP web services
      • Supports RPC & Document type services
      • Carries some limitations
    4. Setting up & running Web Service in 5 minutes
      • Download the NuSOAP library
      • Use the library
      • Define a unique namespace (or more, if required)
      • Define and instantiate a NuSOAP server object
      • Initialize WSDL with namespace (defined above) for the NuSOAP instance
      • Set result / output namespace schema
      • Register method(s) to be served by the Web Service
      • Define method(s) (used as web service) along with specified signature
      • Read and assign contents of standard input stream to raw post data
      • Send the result as a SOAP response over HTTP
    5. Example
      • <?php require_once('lib/nusoap.php'); $ns = &quot; http://localhost:8000 &quot;; $server = new soap_server; $server->configureWSDL('fooMethod1',$ns); $server->configureWSDL('fooMethod2',$ns); $server->wsdl->schemaTargetNamespace=$ns;
    6. Example continued
      • $server->register('fooMethod1', array('param1' => 'xsd:string', 'param2' => 'xsd:string' ), array('return' => 'xsd:boolean'), $ns );
      • $server->register('fooMethod2', array('param1' => 'xsd:string', 'param2' => 'xsd:string' ), array('return' => 'xsd:boolean'), $ns);
    7. Example continued
      • function fooMethod1($param1, $param2) { // some statements... return true; // or false; }
      • function fooMethod2($param1, $param2) { // some statements... return true; // or false; }
    8. Example continued
      • $HTTP_RAW_POST_DATA = file_get_contents(&quot;php://input&quot;); $server->service($HTTP_RAW_POST_DATA); ?>
      • Suppose above file is stored as ws.php on localhost.
      • The WSDL is http://localhost:8000/ws.php?wsdl
      • Also, try opening http://localhost:8000/ws.php !
    9. References
      • NuSOAP http://sourceforge.net/projects/nusoap/
      • PHP Wrappers http://www.php.net/wrappers.php

    + Harit KothariHarit Kothari, 8 months ago

    custom

    1203 views, 2 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1203
      • 1203 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 2
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    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?