473,398 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

php soap server/client

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...

Expand|Select|Wrap|Line Numbers
  1. $client = new SoapClient("http://67.96.115.172/dev/soap/TeamAmerica.wsdl");
  2. $cities = $client->getCitiesByCountry("US");
  3. echo "<BR>".count($cities)." cities found";
  4.  
  5. if(is_array($cities)) {
  6.     foreach($cities as $city) {
  7.         echo "\n<BR>".$city->City->city_code."cn:".$city->city_name;
  8.     }
  9. }
but that prints nothing!

my server is:

Expand|Select|Wrap|Line Numbers
  1. ini = ini_set("soap.wsdl_cache_enabled","0");
  2.  
  3. class City {
  4.     var $city_code;
  5.     var $city_name;
  6.     var $country_code;
  7.     var $country_name;
  8.     function City($citycode,$cityname,$countryname,$countrycode) {
  9.         $this->city_code=$citycode;
  10.         $this->city_name=$cityname;
  11.         $this->country_name=$countryname;
  12.         $this->country_code=$countrycode;
  13.     }
  14. }
  15.  
  16.  
  17. class SoapService {
  18.     function getCitiesByCountry($country_code)
  19.     {
  20.         $cities = array();
  21.         $db = mysql_connect('', '', '');
  22.         mysql_select_db('dev_db', $db);
  23.         $sql = "SELECT * FROM tblCity WHERE country_code='".$country_code."'";
  24.         $city = mysql_query("SELECT * FROM tblCity WHERE country_code='".$country_code."'", $db);
  25.         while($row = mysql_fetch_object($city))
  26.         {    $cities[] = new City($row->CityCode,$row->CityName,$row->country,$country_code);
  27.         }
  28.         mysql_close($db);
  29.         return $cities;
  30.     }
  31. }
  32.  
  33. $classmap = array('City' => 'City');
  34. $server = new SoapServer("http://67.96.115.172/dev/soap/TeamAmerica.wsdl",array('classmap'=> $classmap));
  35. $server->setClass("SoapService");
  36. $server->handle();
thanks for the help/suggestions or links you could provide.
Dec 27 '06 #1
0 2420

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Arne Kösling | last post by:
Hi ! I am new to Web Services. Therefore I ve set up a PHP Installation on Windows (PHP 4.3.2 and Apache 1.3.29). I have tested PHP alone and then installed PEAR. Now I am stuck there (Before...
0
by: David | last post by:
Hi everyone, I wonder how is it possible to make PHP SOAP extension convert the returned complex type to an instance of one of my classes. Here I give you a short example: complexTest.wsdl:...
0
by: Matt Wood | last post by:
Hi, I have written a Web Service for a customer which expects a SOAP message with Document/Literal encoding, and uses RoutingStyle=SoapServiceRoutingStyle.RequestElement to route the SOAP body...
0
by: info | last post by:
Dear all, is the first time that I use SOAP, and i must say that i'm having several problems. this is SOAP message that expects the server =================XML EXPECTED FROM THE...
0
by: kencana | last post by:
hi All, I got problem in passing data (more than one) from soap client to the soap server. but if i only passing one data at a time, it works successfully.. The following is the error message i...
1
by: libsfan01 | last post by:
Hi all Can anyone explain the relationship between SOAP and XMLHttpRequest in Javascript? What actually is SOAP? and how does it relate to the process of transferring data client-side through...
4
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code...
2
by: pmlane2001 | last post by:
I have a PHP SOAP XML file size problem that I was wondering if anyone has seen before. I have an XML file that when I put it through my PHP script with 270 lines (13,082 KB) it works fine. If I...
2
by: furrypop | last post by:
Hi, I'm trying to get the Perl SOAP::Lite examples to work on a Windows PC, running Apache 2.2.4. Apache is definitely serving CGI scripts, as I've tested a dummy Hello World thing. I'm also...
1
by: parimalb | last post by:
Hi All, I want to pass an array argument to the java webservice from perl client using SOAP::LITE package. Please let me know if anyone knows about this. The web method declaration in java is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.