Jump to content

TheVillain9

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

TheVillain9's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i'm working on a php soap server. i'm not entirely sure if my problem is with the server or just if i need to do something else on the client side. basically i created a sample client at: http://67.96.115.172/dev/client.php the server is suppose to return back an array of an object called City, which has city code,name,country and country_code. on the client when i try to iterate through the array i am doing... [code]$client = new SoapClient("http://67.96.115.172/dev/soap/TeamAmerica.wsdl"); $cities = $client->getCitiesByCountry("US"); echo "<BR>".count($cities)." cities found"; if(is_array($cities)) { foreach($cities as $city) { echo "\n<BR>".$city->City->city_code."cn:".$city->city_name; } }[/code] but that prints nothing! my server is: [code]ini = ini_set("soap.wsdl_cache_enabled","0"); class City { var $city_code; var $city_name; var $country_code; var $country_name; function City($citycode,$cityname,$countryname,$countrycode  ) { $this->city_code=$citycode; $this->city_name=$cityname; $this->country_name=$countryname; $this->country_code=$countrycode; } } class SoapService { function getCitiesByCountry($country_code) { $cities = array(); $db = mysql_connect('', '', ''); // left blank on purpose mysql_select_db('dev_db', $db); $sql = "SELECT * FROM tblCity WHERE country_code='".$country_code."'"; $city = mysql_query("SELECT * FROM tblCity WHERE country_code='".$country_code."'", $db); while($row = mysql_fetch_object($city)) { $cities[] = new City($row->CityCode,$row->CityName,$row->country,$country_code); } mysql_close($db); return $cities; } } $classmap = array('City' => 'City'); $server = new SoapServer("http://67.96.115.172/dev/soap/TeamAmerica.wsdl",array('classmap'=> $classmap)); $server->setClass("SoapService"); $server->handle();[/code] the wsdl file is [url=http://67.96.115.172/dev/soap/TeamAmerica.wsdl]http://67.96.115.172/dev/soap/TeamAmerica.wsdl[/url] thanks for the help. ???
  2. I'm a noob to PHP coding so please forgive my stupid questions.  I have two classes... class Hotel { var $name; var $tariffs; // array of Tariff var $availability; var $location; } class Tariff { var $fromDate; var $toDate; var $price; var $currency; } Is it legit to place the Tariff class within the Hotel class? Secondly would this be the correct way to access a tariff? $curhotel = // current hotel $attrs['...'] = // just an XML value $hotels[$curhotel]->tariffs[$attrs['FROMDATE']] = new Tariff(); $hotels[$curhotel]->tariffs[$attrs['FROMDATE']]->fromDate = $attrs['FROMDATE']; $hotels[$curhotel]->tariffs[$attrs['FROMDATE']]->toDate = $attrs['TODATE']; Lastly what is the difference in declaring a variable using "var" and not using it. Thanks so much for the quick help as  I just ordered a book so I do plan on learning it properly  :D
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.