ez.no / exponential / documentation / development / libraries / ez soap / consuming web services with ez soap client
These documentation pages are no longer maintained. Please visit the new documentation site.
The following is a simple example of fetching some data from the service using the eZ SOAP Client and the service described at http://www.capescience.com/webservices/globalweather/index.shtml
<?php // Switch off notices error_reporting(E_ALL ^ E_NOTICE); // Set the include path for Exponential ini_set('include_path','/home/username/exponential-3.0-2/'); // Require the necessary libraries require_once('lib/ezsoap/classes/ezsoapclient.php'); require_once('lib/ezsoap/classes/ezsoaprequest.php'); // Airport code for "Rost Flyplass" in Norway $icao='ENRS'; // Create the SOAP client $client=new eZSOAPClient("live.capescience.com","/ccx/GlobalWeather"); // Create a SOAP request $request=new eZSOAPRequest("getStation","capeconnect:GlobalWeather:StationInfo"); // Add the airpoint code to the request $request->addParameter("station",$icao); // Send the request to get back a response object $response = $client->send($request); if( $response->isFault() ) { trigger_error($response->faultString()); return false; } else { echo ( '<pre>' ); print_r( $response->value() ); echo ( '</pre>' ); } ?>
My experience of eZ SOAP so far is that it's not stable at this time (3.0.2) it particular seems to have problems with multidimensional arrays as responses so be warned. You may want to consider PEAR::SOAP as an alternative for the time being, until 7x have brought eZ SOAP to a more stable basis.
For an example of PEAR::SOAP using WSDL see http://www.phppatterns.com/index.php/article/articleview/39/1/2/.
Note also if you need interim WSDL support with eZ SOAP Client, this can also be achieved with help from PEAR::SOAP WSDL - see http://www.phppatterns.com/index.php/article/articleview/40/1/2/ for details.
eZSoap recommends or links to EasySoap++. This C++ libary is very buggy. You might consider using another one.
log in or create a user account to comment.
Comments