[XML-SIG] Problem using xmlrpclib.

Brendan Rankin brendan at Magma-DA.COM
Wed Aug 6 13:22:01 EDT 2003


I am a complete newbie to xmlrpc and am trying to implement the client side
access to a SalesForce.com server.  They supply both an XMLRPC and a SOAP
API.  They have a two step authentication process to get logged in, which
goes like this:

1.  Login using "https://www.salesforce.com/servlet/servlet.Api".
	- This returns the following XML fields:
		'userID':'<unique user ID>'
		'server_url': '<server to use for API transactions>'
		'session_id' : '<unique session ID>'
	- It also returns two "Set-Cookie" fields in the HTML headers (example
shown below, not a "real" session_id):
		header: Set-Cookie: sfdcweb=; path=/;
		header: Set-Cookie: sid=<ridiculously long session_id string>; path=/

2.  The next step is to take 'session_id' and 'userID' and pass it along to
the server specified by 'server_url', along with whatever API command you'd
like to accomplish.

I, successfully, receive the login Response, but when I send the next API
Request, I consistently get the following error:
send: 'POST /servlet/servlet.Api HTTP/1.0\r\nHost:
na1-api.salesforce.com\r\nUser-Agent: xmlrpclib.py/1.0.1 (by
www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length:
send: "<?xml version='1.0'
reply: 'HTTP/1.0 200 OK\r\n'
header: Server: Resin/2.1.9
header: Content-Type: text/xml; charset=UTF-8
header: Date: Wed, 06 Aug 2003 18:36:19 GMT
body: '<?xml version="1.0" encoding="UTF-8"
ue>session ID missing or
Traceback (most recent call last):
  File "./bin/Python/sforceXMLRPC.py", line 56, in ?
    transactionServer.sfdc.get_server_timestamp( timestampParams )
  File "/usr/lib/python2.3/xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.3/xmlrpclib.py", line 1316, in __request
  File "/usr/lib/python2.3/xmlrpclib.py", line 1080, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.3/xmlrpclib.py", line 1219, in _parse_response
    return u.close()
  File "/usr/lib/python2.3/xmlrpclib.py", line 742, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 1112: 'session ID missing or invalid'>

I can attribute this problem to two possible issues:

1.  Some sort of strange type-mismatch with what SalesForce.com is expecting
to see in the session_id field.
	- Could also be an improperly set field for session_id.
2.  My request does not contain the Cookie fields in the HTML headers.

Does anyone out there have any further suggestions?  Any help would be
greatly appreciated!

Thank you and Best Regards,

- Brendan

More information about the XML-SIG mailing list