我正在尝试在 Zend 框架 2 中创建一个 SOAP 客户端,我创建了以下正确返回数据的客户端
try {
$client = new Zend\Soap\Client("http://www.webservicex.net/country.asmx?WSDL");
$result = $client->GetCountries();
print_r($result);
} catch (SoapFault $s) {
die('ERROR: [' . $s->faultcode . '] ' . $s->faultstring);
} catch (Exception $e) {
die('ERROR: ' . $e->getMessage());
}
但是,当我尝试将数据发送到网络服务时,例如使用
try {
$client = new Zend\Soap\Client("http://www.webservicex.net/country.asmx?WSDL");
$result = $client->GetCurrencyByCountry('Australia');
print_r($result);
} catch (SoapFault $s) {
die('ERROR: [' . $s->faultcode . '] ' . $s->faultstring);
} catch (Exception $e) {
die('ERROR: ' . $e->getMessage());
}
我刚收到以下消息
ERROR: [soap:Receiver] System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Procedure or function 'GetCurrencyByCountry' expects parameter '@name', which was not supplied. at WebServicex.country.GetCurrencyByCountry(String CountryName) --- End of inner exception stack trace ---
如何为 web 服务提供参数?