shyami 0 Newbie Poster

Hello there,

i created a webservice in php using SOAP. Now i need to invoke that in my python.


Here is my php code
soapserver.php

<?php
function getSessionData($sid) {
mysql_connect('localhost','root','');
mysql_select_db('database');
$query = "SELECT Uname FROM tablename";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
return $row['Uname'];
}
require('nusoap.php');
$server = new soap_server();
$server->configureWSDL('soapserver', 'urn:stockquote');
$server->register("getSessionData",
array('sid' => 'xsd:string'),
array('return' => 'xsd:string'),
'urn:stockquote',
'urn:stockquote#getStockQuote');
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)
? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>

Here is client

<?php
require_once('nusoap.php');
$getsid = $_GET['sid'];
echo $getsid. "<br>";
$c = new soapclientNusoap('http://localhost:90/testsoap/stockserver.php');

$uname = $c->call('getSessionData',
array('sid' => '$getsid'));
echo "The Uname  for $getsid is",$uname;
?>

I need to call this client to get a uname in python.


Thanks
-Shyami

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.