我一直在使用codeIgniter(PHP Framework)测试nuSoap但似乎nuSoap不准备使用最新的php 5.3,即使我为php 5.3下载了修补的nusoap版本
我有以下代码:
require_once(APPPATH.'libraries/NuSOAP/lib/nusoap'.EXT); //includes nusoap
$n_params = array('CityName' => 'San Juan', 'CountryName' => 'Argentina');
$client = new nusoap_client('http://www.webservicex.net/globalweather.asmx?WSDL');
$client->setHTTPProxy("10.2.0.1",6588,"","");
$result = $client->call('GetWeather', $n_params);
您能帮助我将这些功能转换为PHP soap功能吗?包括代理功能?
答案 0 :(得分:2)
require_once(APPPATH.'libraries/NuSOAP/lib/nusoap'.EXT); //includes nusoap
$n_params = array('CityName' => 'San Juan', 'CountryName' => 'Argentina');
$client = new nusoap_client('http://www.webservicex.net/globalweather.asmx?WSDL');
$client->setHTTPProxy("10.2.0.1",6588,"","");
$result = $client->call('GetWeather', $n_params);
变为
$url = 'http://www.webservicex.net/globalweather.asmx?WSDL';
$params = array(
'proxy_host' => '10.2.0.1',
'proxy_port' => '6588'
);
$client = new SoapClient($url, $params);
$client->__soapCall('GetWeather', $n_params);
答案 1 :(得分:-1)
以下代码是调用上述Web服务的正确方法。我刚刚修改了$ ser_params数组。现在它有一个子数组
$url = 'http://www.webservicex.net/globalweather.asmx?WSDL';
$conn_params = array(
'proxy_host' => '10.2.0.1',
'proxy_port' => '6588'
);
$ser_params = array (
'GetWeather' => array (
"CityName" => "San Juan",
"CountryName" => "Argentina"
)
);
$client = new SoapClient($url, $conn_params);
$result = $client->__soapCall('GetWeather', $ser_params);
print_r ($result);