hi i am facing problem in dsisplaying result.. |
|
This is the server code..
require_once('lib/nusoap.php'); $s = new soap_server; //$NAMESPACE = 'http://localhost/ibmsoap/server.php?wsdl'; $NAMESPACE = 'http://localhost/ibmsoap'; $s->configureWSDL('server', $NAMESPACE); $s->wsdl->schemaTargetNamespace = $NAMESPACE; $s->register( // method name: 'getrubname', // parameter list: array('apikey'=>'xsd:apikey'), // return value(s): array('return'=>'xsd:courses'), // namespace: $namespace, // soapaction: (use default) false, // style: rpc or document 'rpc', // use: encoded or literal 'encoded', // description: documentation for the method 'Smart Webservice GetRub Method'); this is the method calling function getrubname($apikey){ $course = new GET_RUBNAME; return $course->ListCourses($apikey); } class GET_RUBNAME { function DB_Open(){ mysql_connect ("67.205.89.174", "smart_api", "smartapi"); mysql_select_db ("smartapi"); } function ListCourses($apikey){ $this->DB_Open(); $error_msg="Your Api Key is Invalid"; $sql = "SELECT * FROM apikey WHERE apikey=$apikey"; $data1 = mysql_query($sql); $count = @mysql_num_rows($data1); $query = "select rubid, rubname, urlrewrit from rubriques order by rubname"; $result = mysql_query($query); $cnt = 0; while ($course = mysql_fetch_assoc($result)){ $courses[$cnt] = array('name' => $course["rubname"], 'number' => $course["rubid"], 'seats' => $course["urlrewrit"]); $cnt = $cnt + 1; } return $courses; } } $HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : ''; $s->service($HTTP_RAW_POST_DATA); exit(); This is the Client code.. can anyone help me to get a result.. require_once('lib/nusoap.php'); $server_url="http://localhost/ibmsoap/server/server.php"; $op=$_REQUEST['op']; $parameters = array('apikey'=>$apikey); $soapclient = new soapclient(''.$server_url.'?op=getrubname'); $rubname = $soapclient->call('getrubname', $parameters); echo "<b>List Of Rub</b></br>"; if(count($rubname)<=1) { echo "<span class=\"style6\">"; echo $rubname; echo "</apan>"; } foreach ($rubname as $c) { foreach ($c as $info) { echo "<table><tr><td><a href=".'smart_client.php?op=getsecname&apikey='.$API.'&rubid='.$info["number"]."><span class=\"style6\"> ".$info["name"]."</span></a></tr></table>"; } echo "<hr />"; OUR PUT: Request POST /ibmsoap/server.php HTTP/1.0 User-Agent: NuSOAP/0.6.3 Host: localhost Content-Type: text/xml Content-Length: 540 SOAPAction: "http://localhost/ibmsoap/server.php" <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd" xmlns:nu="http://testuri.org"><SOAP-ENV:Body><nu:getrubname><apikey xsi:type="xsd:apikey">1234</apikey></nu:getrubname></SOAP-ENV:Body></SOAP-ENV:Envelope> Response HTTP/1.1 200 OK Date: Sat, 08 Nov 2008 12:18:00 GMT Server: Apache/2.2.8 (Win32) PHP/5.2.6 X-Powered-By: PHP/5.2.6 Status: 200 OK Connection: Close Content-Length: 4741 Content-Type: text/xml; charset=UTF-8 <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd"><SOAP-ENV:Body><getrubnameResponse><return xsi:type="xsd:courses">Array</return></getrubnameResponse></SOAP-ENV:Body></SOAP-ENV:Envelope><!-- soap_server: entering parseRequest() on 12:18 2008-11-08 soap_server: User-Agent: NuSOAP/0.6.3 soap_server: Host: localhost soap_server: Content-Type: text/xml soap_server: Content-Length: 540 soap_server: SOAPAction: "http://localhost/ibmsoap/server.php" soap_server: got encoding: UTF-8 soap_server: method name: getrubname soap_server: method 'getrubname' exists soap_server: calling parser->get_response() soap_server: parser debug: soap_parser: Entering soap_parser() soap_parser: found root struct getrubname, pos 2 soap_parser: adding data for scalar value apikey of value 1234 soap_parser: inside buildVal() for getrubname(pos 2) of type struct soap_parser: parsed successfully, found root struct: 2 of name getrubname soap_server: params var dump array(1) { ["apikey"]=> &int(1234) } soap_server: calling 'getrubname' with params soap_server: calling method using call_user_func_array() soap_server: response var dumparray(9) { [0]=> array(3) { ["name"]=> string(35) "Cadeaux Ateliers / Loisirs cr�atifs" ["number"]=> string(1) "2" ["seats"]=> string(43) "coffrets-cadeaux-ateliers-loisirs-creatifs/" } [1]=> array(3) { ["name"]=> string(20) "Cadeaux Aventure Air" ["number"]=> string(1) "6" ["seats"]=> string(30) "coffrets-cadeaux-aventure-air/" } [2]=> array(3) { ["name"]=> string(20) "Cadeaux Aventure Eau" ["number"]=> string(1) "9" ["seats"]=> string(30) "coffrets-cadeaux-aventure-eau/" } [3]=> array(3) { ["name"]=> string(22) "Cadeaux Aventure Terre" ["number"]=> string(1) "7" ["seats"]=> string(32) "coffrets-cadeaux-aventure-terre/" } [4]=> array(3) { ["name"]=> string(17) "Cadeaux Bien-Etre" ["number"]=> string(1) "1" ["seats"]=> string(26) "coffrets-cadeaux-bien-etre" } [5]=> array(3) { ["name"]=> string(2 "Cadeaux Culture & D�couverte" ["number"]=> string(1) "3" ["seats"]=> string(36) "coffrets-cadeaux-culture-decouverte/" } [6]=> array(3) { ["name"]=> string(19) "Cadeaux Gastronomie" ["number"]=> string(1) "4" ["seats"]=> string(29) "coffrets-cadeaux-gastronomie/" } [7]=> array(3) { ["name"]=> string(27) "Cadeaux Vitesse et Pilotage" ["number"]=> string(1) "5" ["seats"]=> string(37) "coffrets-cadeaux-vitesse-et-pilotage/" } [8]=> array(3) { ["name"]=> string(6) "Divers" ["number"]=> string(1) "8" ["seats"]=> string(24) "coffrets-cadeaux-divers/" } } soap_server: done calling method: getrubname, received Array of typearray soap_server: got a(n) array from method soap_server: serializing return value soap_server: return val:string(45) "<return xsi:type="xsd:courses">Array</return>" soap_server: serializing response soap_server: WSDL debug data: wsdl: in serializeRPCParameters with operation getrubname, direction output and 1 param(s), and xml schema version http://www.w3.org/2001/XMLSchema wsdl: array(10) { ["name"]=> string(10) "getrubname" ["binding"]=> string(13) "serverBinding" ["endpoint"]=> string(35) "http://localhost/ibmsoap/server.php" ["soapAction"]=> string(35) "http://localhost/ibmsoap/server.php" ["style"]=> string(3) "rpc" ["input"]=> array(5) { ["use"]=> string(7) "encoded" ["namespace"]=> NULL ["encodingStyle"]=> string(41) "http://schemas.xmlsoap.org/soap/encoding/" ["message"]=> string(17) "getrubnameRequest" ["parts"]=> array(1) { ["apikey"]=> string(10) "xsd:apikey" } } ["output"]=> array(5) { ["use"]=> string(7) "encoded" ["namespace"]=> NULL ["encodingStyle"]=> string(41) "http://schemas.xmlsoap.org/soap/encoding/" ["message"]=> string(1 "getrubnameResponse" ["parts"]=> array(1) { ["return"]=> string(11) "xsd:courses" } } ["namespace"]=> NULL ["transport"]=> string(36) "http://schemas.xmlsoap.org/soap/http" ["documentation"]=> string(0) "" } wsdl: got 1 part(s) wsdl: in serializeType: return, xsd:courses, Array wsdl: got a prefixed type: courses, xsd soap_server: server sending... --> with this error.. Warning: Invalid argument supplied for foreach() in D:\ibm\wamp\www\ibmsoap\smart_client.php on line 148 Please some one help me.. this is the be a great help if u can suggest me any idea.. |
||||||||||||
|
hi i am facing problem in dsisplaying result.. |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by