Location: PHPKode > scripts > SOAP Proxy > example_weather_proxy_call2.php
<?php
include('src_config.php');

require('SoapProxy.php');
require('output/WeatherService.php');


//add soap class mapping to catch response in own class
$opts['classmap'] = array (
	'GetWeatherResponse' => 'MyResponse',
);


/**
 * Extended GetWeatherResponse to provide
 * example methods in ws response class
 * 
 * @author Przemek Berezowski
 *
 */
class MyResponse extends WeatherParam_GetWeatherResponse {
	
	/**
	 * This is an example method to print ws answer in reverse order
	 */
	public function exampleMethod() {
		return strrev($this->GetWeatherResult);
	} 
	
}

//create service instance 
$service = new WeatherService($wsdl, $opts);
//create and setup parameter for call
$param = new WeatherParam_GetWeather();
$param->City = 'New York';

//run ws method
$result = $service->GetWeather($param);

//run a method in response class
echo 'Result is: '.$result->GetWeatherResult;
echo '<br />'; 
echo 'Result in reverse order is: '.$result->exampleMethod();

echo "<hr />";
echo 'Soap requst<br />';
//printing soap request
highlight_string($service->soapClient->__getLastRequest());

echo "<hr />";
echo 'Soap response<br />';
//printing soap response
highlight_string($service->soapClient->__getLastResponse());
Return current item: SOAP Proxy