• Test.ax41
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hello,

I am having some difficulty using the 'session_id' returned by the login Response using Python 2.3.  Prior to this version of Python, xmlrpclib would always fail because it wasn't able to deal with Boolean types.  I am quite new to XMLRPC, so please forgive me if the question is ignorant.

Here's the, quite simple, code I am using:

----------

import xmlrpclib

loginServer = xmlrpclib.Server("https://www.salesforce.com/servlet/servlet.Api")
loginParams = {'version':'2.0',
               'username':'covenantr@yahoo.com',
               'password':'luvPilar',
               'secure':True
               }

loginResponse = loginServer.sfdc.login(loginParams)

print loginResponse

transactionServer = xmlrpclib.Server( loginResponse['server_url'] )

logoutParams = {'version':'2.0',
                'session_id':loginResponse['session_id']
                }

logoutResponse = transactionServer.sfdc.logout(logoutParams)

----------

Here's what I get as output:

--------

$ python scripts/sforceXMLRPC.py
{'userID': '00530000000c4BV', 'server_url': 'https://na1-api.salesforce.com/serv
let/servlet.Api', 'session_id': 'rZVyAYxJHzioUs1Tx5x9CeWp5QeKVIIPcwDAUguWiqV9vYt
04QqF5QemGXwg.IDWkWByTFHyy2rvJ4CmaYRpUfbtzKggVlhL'}
Traceback (most recent call last):
  File "scripts/sforceXMLRPC.py", line 43, in ?
    logoutResponse = transactionServer.sfdc.logout(logoutParams)
  File "c:\Python23\lib\xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "c:\Python23\lib\xmlrpclib.py", line 1316, in __request
    verbose=self.__verbose
  File "c:\Python23\lib\xmlrpclib.py", line 1080, in request
    return self._parse_response(h.getfile(), sock)
  File "c:\Python23\lib\xmlrpclib.py", line 1219, in _parse_response
    return u.close()
  File "c:\Python23\lib\xmlrpclib.py", line 742, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1112: 'session ID missing or invalid'>

-----------

As you can see, the loginResponse dictionary looks correct.  I "think" I'm doing the correct thing by creating a new server instance for the remaining transactions, while grabbing the 'session_id' and other parameters from the login Response.

Any hints, ideas, or help into why this is failing would be great!!

Thanks and Best Regards,

- Covenant