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) }

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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