Home arrow Zend arrow Page 3 - PHP SOAP Extension

Using WSDL - Zend

This article describes the new SOAP extension for PHP. It is intended for PHP developers who want to write their own Web Services servers, or use SOAP to access existing ones. It assumes some familiarity with Web Services, SOAP, and WSDL (Web Services Description Language).

  1. PHP SOAP Extension
  2. A First SOAP Client
  3. Using WSDL
  4. A First SOAP Server
  5. Creating the Server
  6. Example 6
  7. Example 8 (client5.php)
  8. Other Implementations of SOAP for PHP
By: Zend
Rating: starstarstarstarstar / 23
March 17, 2004

print this article



Here is the same PHP SOAP client, rewritten using that WSDL document. Now we donít need to specify the endpoint URI, namespace, SOAPAction header, encoding style and parameter types. All the information comes from the WSDL file.

Example 2 (client2.php)

= new SoapClient("http://services.xmethods.net/  soap/urn:xmethods-delayed-quotes.wsdl);
? >

Thatís a little easier, isnít it?
What are the problems with WSDL? The only argument against using it is that the client has to load the relevant WSDL document from the server before the RPC can be made, and this can take a significant amount of time in a Web environment. In order to speed things up, PHPís ext/soap uses a WSDL caching feature that can be controlled through setting the soap.wsdl_cache_enabled, soap.wsdl_cache_dir and soap.wsdl_cache_ttl configuration directives, either in your  php.ini or by using ini_set()(see Example 4) ). By default, WSDL caching is turned on and caches WSDL files for one day.
Here is the SOAP section for php.ini with default values.  You can paste it into your php.ini.

soap.wsdl_cache_enabled "1"
enables or disables WSDL caching feature
.wsdl_cache_dir "/tmp"
sets the directory name where SOAP extension will put cache files
.wsdl_cache_ttl "86400" 
; (time to livesets the number of second while cached file will be used
instead of original one

>>> More Zend Articles          >>> More By Zend

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- 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

Developer Shed Affiliates


Dev Shed Tutorial Topics: