Jump to content

Unable to pass STRING as a parameter to my webservice call in client script..! HELP needed please


hivenky01

Recommended Posts

Hi Guys, I Created a webservice in php, The code is as follows 

 

Server.php

 

 

<?php 
 
function addid($id) {
mysql_connect('localhost','admin','password'); 
mysql_select_db('mm'); 
$query = "INSERT INTO temp(`id`) VALUES ($id)"; 
$result = mysql_query($query); 
if($result){
$res = "true";
return $res;
}
else{
$res = "fal";
return $res;
}
 
 
require('nusoap.php'); 
$server = new soap_server(); 
$server->configureWSDL('details', 'urn:firstname'); 
$server->register("addid", 
array('userid' => 'xsd:firstname'), 
array('name' => 'xsd:lastname'), 
'urn:lasstname', 
'urn:lastname#getfirstname'); 
 
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) 
? $HTTP_RAW_POST_DATA : ''; 
$server->service($HTTP_RAW_POST_DATA); 
?> 
 
 
 
Client Script 
 
<?php 
require_once('nusoap.php'); 
echo "starting";
$str = '5070';
$name = $c->call('addid',array('id' => $str)); 
echo "result is ".$name; 
?>
 
 
 
Now the Problem is: If the value of variable is a number the program is executed well and the value is stored in db
if the value of variable is sting then the program is executing but the else part of server script is executed..!
 
 
Whats wrong in this code. the schema of temp table is temp { 
id varchar(10) }

 

Archived

This topic is now archived and is closed to further replies.

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