У меня проблемы с получением желаемых результатов от WSDL.
Мой скрипт:
<code><?php
require_once($_SERVER['DOCUMENT_ROOT'].'/lib/classes/class.glssoap.php');
$glssoap = new GLSSoap;
echo "<pre>";
//print_r($glssoap->GetOneParcelShop(96101)); // SUCCESS
//print_r($glssoap->GetAllParcelShops()); // SUCCESS
print_r($glssoap->GetAllParcelShopsInZipcode(8000)); // FAILS : RETURNS operation GetAllParcelShopsInZipcode not present.
print_r($glssoap->GetNearestParcelShops('Kriegersvej 8', '8000')); // FAILS : RETURNS operation GetNearestParcelShops not present.
print_r($glssoap->SearchNearstParcelShops('Kriegersvej 8', '8000')); // FAILS : RETURNS operation SearchNearstParcelShops not present.
echo "
";
?>
Класс:
<code><?php
class GLSSoap {
//Get one ParcelShop
public function GetOneParcelShop($parcelShopNumber)
{
$gls_params = array();
$gls_params['ParcelShopNumber'] = $parcelShopNumber;
$result = $this->_soapcall('GetOneParcelShop', $gls_params);
return $result;
}
//Returns all ParcelShops in Denmark
public function GetAllParcelShops()
{
$gls_params = array();
$result = $this->_soapcall('GetAllParcelShops', $gls_params);
return $result;
}
//Returns all ParcelShops in a zipcode
public function GetAllParcelShopsInZipcode($zipCode)
{
$gls_params = array();
$gls_params['Zipcode'] = $zipCode;
$result = $this->_soapcall('GetAllParcelShopsInZipcode', $gls_params);
return $result;
}
//Search for the nearest ParcelShops to an address - Strict version - used for automated processing
public function GetNearestParcelShops($street, $zipCode, $amount = 4)
{
$gls_params = array();
$gls_params['Street'] = $street;
$gls_params['zipcode'] = $zipCode;
$gls_params['amount'] = $amount;
$result = $this->_soapcall('GetNearestParcelShops', $gls_params);
return $result;
}
//Search for the nearest ParcelShops to an address - Loose version - user should veryfi data
public function SearchNearstParcelShops($street, $zipCode, $amount = 4)
{
$gls_params = array();
$gls_params['Street'] = $street;
$gls_params['zipcode'] = $zipCode;
$gls_params['amount'] = $amount;
$result = $this->_soapcall('SearchNearstParcelShops', $gls_params);
return $result;
}
private function _soapcall($call, $params)
{
require_once(dirname(__FILE__).'/class.nusoap.php');
$soapclient = new nusoap_client('http://www.gls.dk/webservices_v2/wsPakkeshop.asmx?WSDL','wsdl');
$result = $soapclient->call($call, array('parameters' => $params));
/* Debug */
echo '<h2>Request</h2><pre>' . htmlspecialchars($soapclient->request, ENT_QUOTES) . '
';
echo '
Response
' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '
';
// echo '
Debug
' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '
';
echo '
'; print_r($result); echo '
';
// Проверка на неисправность
if ($ soapclient-> fault) {
echo '
Fault
';
print_r($result);
echo '
';
} еще {
// Проверка на ошибки
$ err = $ soapclient-> getError ();
if ($ err) {
// Показать ошибку
echo '
';
} еще {
вернуть $ результат;
}
}
вернуть ложь;
}
};
?>
Далее, я использую класс NUSOAP, как показано здесь: http://sourceforge.net/projects/nusoap/
Моя проблема в том, что GetAllParcelShopsInZipcode, GetNearestParcelShops & SearchNearestParcelShops все возвращает «операция X отсутствует».
Сервис, которым я пользуюсь, находится здесь: http://www.gls.dk/webservices_v2/wsPakkeshop.asmx
Может кто-нибудь подсказать, что я делаю не так?
Заранее спасибо