• adamrice32
  • NEWBIE
  • 0 Points
  • Member since 2004

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hi all,

I am trying to simply authenticate against the salesforce development server using the sample code provided in the web services API PDF, and am not having much luck. I am using version 2.5 of the API, and the code I am using looks like:

String loginURL = "http://aspen.salesforce.com/services/Soap/c/2.5";
SoapBindingStub sfdc =
(SoapBindingStub)new SforceServiceLocator().getSoap(new URL(loginURL));
... get username and password (un/pw ivars) ...
LoginResult loginResult = sfdc.login(un, pw);

The execution fails on the sfdc.login() call, with the following fault detail:

{urn:fault.enterprise.soap.sforce.com}fault:
INVALID_SESSION_ID
Invalid Session ID found in SessionHeader

This seems pretty strange to me, as I figured you would not need a session ID to authenticate initially, but instead would pull the session ID from the LoginResult object following a successful authentication. Indeed, it looks as though this is what the Java code is doing. However, I'm getting hoarked up even before that point.

I suspect that I'm missing something very small here. Any help would be greatly appreciated!

Thanks in advance,
Adam Rice

Message Edited by adamrice32 on 02-07-2004 02:42 PM

Hi all,

I am trying to simply authenticate against the salesforce development server using the sample code provided in the web services API PDF, and am not having much luck. I am using version 2.5 of the API, and the code I am using looks like:

String loginURL = "http://aspen.salesforce.com/services/Soap/c/2.5";
SoapBindingStub sfdc =
(SoapBindingStub)new SforceServiceLocator().getSoap(new URL(loginURL));
... get username and password (un/pw ivars) ...
LoginResult loginResult = sfdc.login(un, pw);

The execution fails on the sfdc.login() call, with the following fault detail:

{urn:fault.enterprise.soap.sforce.com}fault:
INVALID_SESSION_ID
Invalid Session ID found in SessionHeader

This seems pretty strange to me, as I figured you would not need a session ID to authenticate initially, but instead would pull the session ID from the LoginResult object following a successful authentication. Indeed, it looks as though this is what the Java code is doing. However, I'm getting hoarked up even before that point.

I suspect that I'm missing something very small here. Any help would be greatly appreciated!

Thanks in advance,
Adam Rice

Message Edited by adamrice32 on 02-07-2004 02:42 PM

Hi,

   Im new to sforce and webservices, Im trying out java sample provided by sforce. What I can see in the folders is only java files, I could not find any wsdl file. So, Can anybody tell me, where can I find wsdl file?

Thanks,

Sri

  • February 07, 2004
  • Like
  • 0

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