Zend
  Home arrow Zend arrow Page 2 - PHP SOAP Extension
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ZEND

PHP SOAP Extension
By: Zend
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 18
    2004-03-17

    Table of Contents:
  • PHP SOAP Extension
  • A First SOAP Client
  • Using WSDL
  • A First SOAP Server
  • Creating the Server
  • Example 6
  • Example 8 (client5.php)
  • Other Implementations of SOAP for PHP

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Ziff Davis Enterprise Virtual Tradeshows: Hot Topics, Cutting Edge Technology, Real-time Interaction with IT Professionals. Learn more at ziffdavisvts.com

    PHP SOAP Extension - A First SOAP Client
    (Page 2 of 8 )


    To demonstrate how to make a simple SOAP Client, we’ll take the XMethods demo service, “Delayed Stock Quote”, as our target. Before we start to write any PHP code, we’ll need to gather some information about this particular service:
    • The method name
    • The endpoint URL where the service is running
    • The SOAPAction header value for the method
    • The namespace URI for the method
    • Input and output parameter names and types

    Happily, all this information is available on the XMethods web site at http://www.xmethods.com/ in the form of the service’s RPC profile:

    Method Name getQuote
    Endpoint URLhttp://66.28.98.121:9090/soap
    SOAPActionurn:xmethods-delayed-quotes#getQuote
    Method Namespace URIurn:xmethods-delayed-quotes
    Input ParametersSymbol                      | String
    Output ParametersResult                        | float


    Example 1 (client1.php)


    <?php
      $client 
    = new SoapClient(NULL,
        
    array(
          
    "location" => "<A href="http://66.28.98.121:9090/soap">http://66.28.98.121:9090/soap</A>",
          "uri"      => "urn:xmethods-delayed-quotes",
          "style"    => SOAP_RPC,
          "use"      => SOAP_ENCODED));
      print($client->__call(
        /* SOAP Method Name */
        "getQuote", 
        /* Parameters */
        array(
          new SoapParam(
            /* Parameter Value */
            "ibm", 
            /* Parameter Name */
            "symbol")),
        /* Options */
        array(
          /* SOAP Method Namespace */
          "uri"        => "urn:xmethods-delayed-quotes",
          /* SOAPAction HTTP Header for SOAP Method */
          "soapaction" => "urn:xmethods-delayed-quotes#getQuote")). "n");
    ? >


    As you can see, this simple task required a lot of work.
    Fortunately, Web Services can describe themselves to the client using WSDL, and generally they achieve this successfully. The location of the WSDL document for the XMethods “Delayed Stock Quote” service is given on the information page for that service at xmethods.com.

    More Zend Articles
    More By Zend


     

       

    ZEND ARTICLES

    - Taking the Zend Certified PHP Engineer Exam:...
    - Quick Introduction to PHP 5
    - PHP SOAP Extension
    - Improving Performance
    - PDFs with PHP part 2
    - PDFs with PHP part 1
    - PHP at Lycos
    - Build Database Interfaces

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway