Python Forum

Full Version: Type Not Found error on python soap call using suds library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i'm converting my php code into python code

here is my php code

$info = new StdClass();
$info->username = 'myUsername'; //Required
$info->password = 'myPassword';

require_once 'nusoap.php';
$client = new nusoap_client('http://myWebServiceAddress?wsdl', true);
$str = $client->call("login", array('loginRequest' => $info));

$contextinfo = new stdClass();
$contextinfo->data = new stdClass();
$contextinfo->data->entry = array('key' => 'SESSION_ID', 'value' => $str['return']);

$requestinfo = new StdClass();
$requestinfo->refNumList = "RefNum";

$str1 = $client->call("verifyTransaction", array('context' => $contextinfo, 'verifyRequest' => $requestinfo));

echo $str1['return']['verifyResponseResults']['amount'];

and when i convert it to python i got this error Exception Value:

Type not found: 'value'

Exception Location: venv\lib\site-packages\suds\mx\literal.py in start, line 87

here is my python code

wsdl_url = WebServiceUrl
schema_url = 'http://www.type-applications.com/character_set/'
schema_import = Import(schema_url)
schema_doctor = ImportDoctor(schema_import)

client = Client(url=wsdl_url, doctor=schema_doctor)

info = {
    "username":int(username),
    "password":int(password)
}
params = {
    'loginRequest':info
}

result = client.service.login(**params)

entry = {
    'key':str('SESSION_ID'),
    'value':str(result)
}
contextinfo = {
    'data':entry
}

requestinfo = {
    "refNumList":RefNum
}
params1 = {
    'context':contextinfo,
    'verifyRequest':requestinfo
}

result = client.service.verifyTransaction(**params1)
first soap calls works well ('client.service.login(**params)') and result has true value

but i got error on second soap call(client.service.verifyTransaction(**params1))

i used suds.Client for soap call and used suds.xsd.doctor for fixing type not found error, but doctor cant fix it for me
You need to provide runnable code (which includes imports) and the full stack trace.