私はWSDLドキュメントでPHPSOAPクライアントを使用しています。クライアントは次のように作成されます。
$client = new SoapClient('http://eklima.met.no/metdata/MetDataService?WSDL');
ここで、パラメータ「language」と「countiesId」を受け取る関数「getCountyTypes」を呼び出します。
$args = array(
'language'=>'no',
'countiesId'=>'2'
);
関数__soapCallを直接使用すると、期待どおりに機能します。
$res = $client->__soapCall('getCountyTypes', $args);
魔法の関数を使おうとしても機能しません。
$res = $client->getCountyTypes($args);
次のエラーが発生します。
PHP Notice: Array to string conversion in /Users/jorgen/soaptest.php on line 60
PHP Fatal error: Uncaught SoapFault exception: [SOAP-ENV:Client] No mapping found for ':countiesId' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'. [java.lang.IllegalArgumentException] in /Users/jorgen/soaptest.php:60
Stack trace:
#0 /Users/jorgen/soaptest.php(60): SoapClient->__call('getCountyTypes', Array)
#1 /Users/jorgen/soaptest.php(60): MySoapClient->getCountyTypes(Array)
#2 {main}
thrown in /Users/jorgen/soaptest.php on line 60
魔法の機能でsoapクライアントを使用する方法についていくつかの指示が必要です。
編集: var_dump($ client-> __ getFunctions());からの出力を追加しました。
array(14) {
[0]=>
string(185) "no_met_metdata_Metdata getMetData(string $timeserietypeID, string $format, string $from, string $to, string $stations, string $elements, string $hours, string $months, string $username)"
[1]=>
string(106) "ArrayOfno_met_metdata_TimeSerieTypes getTimeserieTypesProperties(string $language, string $timeserieTypes)"
[2]=>
string(99) "ArrayOfno_met_metdata_ElementProperties getElementsProperties(string $language, string $elem_codes)"
[3]=>
string(93) "ArrayOfno_met_metdata_ElementProperties getElementsFromTimeserieType(string $timeserietypeID)"
[4]=>
string(111) "ArrayOfno_met_metdata_ElementProperties getElementsFromTimeserieTypeStation(string $timeserietypeID, int $stnr)"
[5]=>
string(97) "ArrayOfno_met_metdata_StationProperties getStationsProperties(string $stations, string $username)"
[6]=>
string(111) "ArrayOfno_met_metdata_StationProperties getStationsFromTimeserieType(string $timeserietypeID, string $username)"
[7]=>
string(140) "ArrayOfno_met_metdata_StationProperties getStationsFromTimeserieTypeElemCodes(string $timeserietypeID, string $elem_codes, string $username)"
[8]=>
string(162) "ArrayOfno_met_metdata_StationProperties getStationsFromTimeserieTypeStationsElemCode(string $timeserietype, string $stations, string $elem_code, string $username)"
[9]=>
string(22) "string getDateFormat()"
[10]=>
string(89) "ArrayOfno_met_metdata_FlagProperties getFlagProperties(string $language, string $flagsId)"
[11]=>
string(110) "ArrayOfno_met_metdata_PrecipitationTypes getPrecipitationTypes(string $language, string $precipitationTypesId)"
[12]=>
string(33) "ArrayOfString getValidLanguages()"
[13]=>
string(86) "ArrayOfno_met_metdata_CountyTypes getCountyTypes(string $language, string $countiesId)"
}