soap - sessions ?

G

gcmartijn

H!

When I use php code nusoap everything works but with python I get
everytime "Your session key does not exist or has expired"

I use this code below:

test = SOAPpy.SOAPProxy("http://secure.easynic.com/com/iomart/
easynicWSv2.cfc?wsdl")
data = test.login(_id='test',_pass='pass')
for item in data:
for item2 in item:
if item2['key']=='KEY':
EASYKEY = item2['value']

# now I have the EASYKEY

# create a customer with the key,
# print output = "Your session key does not exist or has
expired"
print test.createOrUpdateContact(key=EASYKEY,
title=row[0],
firstname=row[2],
initials=row[3],
lastname=row[4],
company=row[5],
phone=row[9],
fax='',
email=row[13],
address1=straat,
address2='',
address3='',
area=row[12],
city=row[8],
country=row[12],
postcode=row[7],
acc_username='',
acc_password='',
domaincontactid='')

# logout , and this works ! (using the same key)
test.logout(key=EASYKEY)

With php this works:

// get the key $_SESSION[CODElogin]
$result = $soapClient->call('login',$params,$_SESSION[serverip],
$_SESSION[serverip])

// make a customer
$params = array(
'key' => $_SESSION[CODElogin],
'title' => $_POST[title],
'firstname' => $_POST[firstname],
'initials' => $_POST[initials],
'lastname' => $_POST[lastname],
'company' => $_POST[company],
'phone' => $_POST[phone],
'fax' => $_POST[fax],
'email' => $_POST,
'address1' => $_POST[address1],
'address2' => $_POST[address2],
'address3' => $_POST[address3],
'area' => $_POST[area],
'city' => $_POST[city],
'country' => $_POST[area],
'postcode' => $_POST[postcode],
'acc_username' => $_POST[acc_username],
'acc_password' => $_POST[acc_password],
'domaincontactid'=> $_POST[domaincontactid]
);

// send
$result = $soapClient->call('createOrUpdateContact',$params,'http://
secure.easynic.com/com/iomart/easynicWSv2.cfc?wsdl','http://
secure.easynic.com/com/iomart/easynicWSv2.cfc?wsdl');

and everything works, what can I do to make this with python ?
or must I use exec("phpprogram.php") ? (I hope not)

Thanks
 
G

gcmartijn

When I use
SOAPpy.Config.dumpSOAPOut = 1
SOAPpy.Config.dumpSOAPIn = 1

will display:

*** Outgoing SOAP
******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"<SOAP-ENV:Body>
<createOrUpdateContact SOAP-ENC:root="1">
<domaincontactid href="#i1"/>
<city href="#i2"/>
<fax href="#i1"/>
<firstname href="#i3"/>
<area href="#i4"/>
<country href="#i4"/>
<address2 href="#i1"/>
<address3 href="#i1"/>
<phone href="#i5"/>
<title href="#i6"/>
<postcode href="#i7"/>
<key href="#i8"/>
<lastname href="#i9"/>
<acc_password href="#i1"/>
<address1 href="#i10"/>
<company href="#i11"/>
<email href="#i12"/>
<acc_username href="#i1"/>
<initials href="#i13"/>
</createOrUpdateContact>
<domaincontactid xsi:type="xsd:string" id="i1" SOAP-ENC:root="0"></
domaincontactid>
<city xsi:type="xsd:string" id="i2" SOAP-ENC:root="0">fsdfsd</city>
<firstname xsi:type="xsd:string" id="i3" SOAP-ENC:root="0">sdfsad</
firstname>
<area xsi:type="xsd:string" id="i4" SOAP-ENC:root="0">NL</area>
<phone xsi:type="xsd:string" id="i5" SOAP-ENC:root="0">+31.243770011</
phone>
<title xsi:type="xsd:string" id="i6" SOAP-ENC:root="0">M</title>
<postcode xsi:type="xsd:string" id="i7" SOAP-ENC:root="0">3432VD</
postcode>
<key xsi:type="xsd:string" id="i8" SOAP-
ENC:root="0">EASYNICAPI2_3057578_53854283</key>
<lastname xsi:type="xsd:string" id="i9" SOAP-ENC:root="0">dfasdf</
lastname>
<address1 xsi:type="xsd:string" id="i10" SOAP-ENC:root="0">dfasdf 3</
address1>
<company xsi:type="xsd:string" id="i11" SOAP-ENC:root="0">safasdf</
company>
<email xsi:type="xsd:string" id="i12" SOAP-
ENC:root="0">[email protected]</email>
<initials xsi:type="xsd:string" id="i13" SOAP-ENC:root="0">fsdfas</
initials>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
************************************************************************
*** Incoming SOAP
******************************************************
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
<soapenv:Body>
<createOrUpdateContactResponse soapenv:encodingStyle="http://
schemas.xmlsoap.org/soap/encoding/">
<createOrUpdateContactReturn href="#id0"/>
</createOrUpdateContactResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://
schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1:Map"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns1="http://xml.apache.org/xml-soap">
<item>
<key xsi:type="ns2:string" xmlns:ns2="http://www.w3.org/2001/
XMLSchema">RESPONSECODE</key>
<value xsi:type="ns3:string" xmlns:ns3="http://www.w3.org/2001/
XMLSchema">999</value>
</item>
<item>
<key xsi:type="ns4:string" xmlns:ns4="http://www.w3.org/2001/
XMLSchema">RESPONSETEXT</key>
<value xsi:type="ns5:string" xmlns:ns5="http://www.w3.org/2001/
XMLSchema">Your session key does not exist or has expired</value>
</item>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
************************************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top