Problem using PEAR::SOAP with other than default class
| From: | Andreas Neumann | Date: | Sat, 25 Oct 2003 23:17:30 +0000 |
| Subject: | Problem using PEAR::SOAP with other than default class | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8583@lists.php.net to get a copy of this message | ||
Hello!
I am trying to use PEAR::SOAP with a Weather service:
http://www.capescience.com/webservices/globalweather/index.shtml
This webservice offerst two different classes of webservices. While I can successfully use methods of class 1, I can't use methods of class 2.
Does anyone have a code example on how I can use methods from others than the first class in a webservice? I guess I need a parameter two call the second class, but don't have an idea how ...
Here is more info:
output of "echo ($wsdl->generateAllProxies());"
class WebService_GlobalWeather_StationInfo extends SOAP_Client
{
function WebService_GlobalWeather_StationInfo(){ $this->SOAP_Client("http://live.capescience.com:80/ccx/GlobalWeather", 0);
}
function &getStation($code) {
return $this->call("getStation",
$v = array("code"=>$code),
array('namespace'=>'capeconnect:GlobalWeather:StationInfo',
'soapaction'=>'capeconnect:GlobalWeather:StationInfo#getStation',
'style'=>'rpc',
'use'=>'encoded' ));
}
function &isValidCode($code) {
return $this->call("isValidCode",
$v = array("code"=>$code),
array('namespace'=>'capeconnect:GlobalWeather:StationInfo',
'soapaction'=>'capeconnect:GlobalWeather:StationInfo#isValidCode',
'style'=>'rpc',
'use'=>'encoded' ));
}
function &listCountries() {
return $this->call("listCountries",
$v = null,
array('namespace'=>'capeconnect:GlobalWeather:StationInfo',
'soapaction'=>'capeconnect:GlobalWeather:StationInfo#listCountries',
'style'=>'rpc',
'use'=>'encoded' ));
}
function &searchByCode($code) {
return $this->call("searchByCode",
$v = array("code"=>$code),
array('namespace'=>'capeconnect:GlobalWeather:StationInfo',
'soapaction'=>'capeconnect:GlobalWeather:StationInfo#searchByCode',
'style'=>'rpc',
'use'=>'encoded' ));
}
function &searchByCountry($country) {
return $this->call("searchByCountry",
$v = array("country"=>$country),
array('namespace'=>'capeconnect:GlobalWeather:StationInfo',
'soapaction'=>'capeconnect:GlobalWeather:StationInfo#searchByCountry',
'style'=>'rpc',
'use'=>'encoded' ));
}
function &searchByName($name) {
return $this->call("searchByName",
$v = array("name"=>$name),
array('namespace'=>'capeconnect:GlobalWeather:StationInfo',
'soapaction'=>'capeconnect:GlobalWeather:StationInfo#searchByName',
'style'=>'rpc',
'use'=>'encoded' ));
}
function &searchByRegion($region) {
return $this->call("searchByRegion",
$v = array("region"=>$region),
array('namespace'=>'capeconnect:GlobalWeather:StationInfo',
'soapaction'=>'capeconnect:GlobalWeather:StationInfo#searchByRegion',
'style'=>'rpc',
'use'=>'encoded' ));
}
}
class WebService_GlobalWeather_GlobalWeather extends SOAP_Client
{
function WebService_GlobalWeather_GlobalWeather(){ $this->SOAP_Client("http://live.capescience.com:80/ccx/GlobalWeather", 0);
}
function &getWeatherReport($code) {
return $this->call("getWeatherReport",
$v = array("code"=>$code),
array('namespace'=>'capeconnect:GlobalWeather:GlobalWeather',
'soapaction'=>'capeconnect:GlobalWeather:GlobalWeather#getWeatherReport',
'style'=>'rpc',
'use'=>'encoded' ));
}
}
-------
here my code to use the webservice:
-------
<?php
include('SOAP/Client.php');
$wsdl=new SOAP_WSDL("http://live.capescience.com/wsdl/GlobalWeather.wsdl");
echo ( $wsdl->generateAllProxies () );
// Create an object directly from the proxy code
$client =$wsdl->getProxy();
$myStationData=$client->getWeatherReport("ZRH");
--
result is an error message:
Call to undefined function: getweatherreport() on line 10 ...
Any help is very appreciated! Thanks,
Andreas