hivenky01 Posted March 31, 2013 Share Posted March 31, 2013 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"; $c = new nusoap_client('http://www.mydomain.com/mm/nusoap/lib/ts2.php'); $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) } Quote Link to comment https://forums.phpfreaks.com/topic/276346-unable-to-pass-string-as-a-parameter-to-my-webservice-call-in-client-script-help-needed-please/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.