Home arrow Zend arrow Page 7 - PHP SOAP Extension

Example 8 (client5.php) - 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).

TABLE OF CONTENTS:
  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
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement


<?php
  $client 
= new SoapClient("stockquote1.wsdl",array(
    
"trace"      => 1,
    
"exceptions" => 0));
  $client
->getQuote("ibm");
  
print "<pre>n";
  
print "Request :n".htmlspecialchars($client->__getLastRequest()) ."n";
  
print "Response:n".htmlspecialchars($client->__getLastResponse())."n";
  
print "</pre>";
? >


Here is the output of the script. It is modified a little, to make it more easily understood.


Request:
<?xml version="1.0" encoding="UTF-8"


<SOAP-ENV:Envelope
  xmlns:SOAP-ENV=
"http://schemas.xmlsoap.org/ soap/envelope/"
  xmlns:ns1="urn:xmethods-delayed-quotes"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  SOAP-ENV:encodingStyle=
"http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
  <ns1:getQuote>
    <symbol xsi:type="xsd:string">ibm</symbol>
  </ns1:getQuote>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Response:
<?xml version="1.0" encoding="UTF-8"


<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:ns1="urn:xmethods-delayed-quotes"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
  <ns1:getQuoteResponse>
    <Result xsi:type="xsd:float">98.42</Result>
  </ns1:getQuoteResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

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

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: