I’m using this webservice through php
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try{
$return = $soap->GetCountriesByContinent(array('continentCode'=>'AS'));
} catch (Exception $e) {
die ('Error: ' . $e->getMessage());
}
var_dump($return->GetCountriesByContinentResult);
I’m getting this result:
object(stdClass)#3 (2) { ["schema"]=> string(607) "" ["any"]=> string(6747) "AFAFGAfghanistanAMARMArmeniaAZAZEAzerbaijanBHBHRBahrainBDBGDBangladeshBTBTNBhutanIOIOTBritish Indian Ocean TerritoryBNBRNBruneiKHKHMCambodiaCNCHNChinaCXCXRChristmas IslandCCCCKCocos IslandsGEGEOGeorgiaHKHKGHong KongININDIndiaIDIDNIndonesiaIRIRNIranIQIRQIraqILISRIsraelJPJPNJapanJOJORJordanKZKAZKazakhstanKWKWTKuwaitKGKGZKyrgyzstanLALAOLaosLBLBNLebanonMOMACMacaoMYMYSMalaysiaMVMDVMaldivesMNMNGMongoliaMMMMRMyanmarNPNPLNepalKPPRKNorth KoreaOMOMNOmanPKPAKPakistanPSPSEPalestinian TerritoryPHPHLPhilippinesQAQATQatarSASAUSaudi ArabiaSGSGPSingaporeKRKORSouth KoreaLKLKASri LankaSYSYRSyriaTWTWNTaiwanTJTJKTajikistanTHTHAThailandTRTURTurkeyTMTKMTurkmenistanAEAREUnited Arab EmiratesUZUZBUzbekistanVNVNMVietnamYEYEMYemen" }
As you can see, getting an array on this way is useless because everything is appended.
So, which is the right way to consume this service?
thanks in advance.
The WSDL definition determines how the SoapClient forms requests and interprets responses.
The method you are trying to access has a response defined as so:
So PHP is converting the XML response to
schemaandany.anyis just a string version of the XML contents.The contents of
anyshould be valid XML, so if you can’t modify the WDSL you can always read the string with an XML parser.