function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mel1Mel1 

salesforce called from powerbuilder gives Invalid_session_id

Hi,

I am trying to run a query on salesforce in Powerbuilder 11.5 via .NET web service and am having troubles running a query.

I got the soap connection set up alright, [can debug and see my current user hex code, session filled up for sforce object] but while running a query I keep getting this error of
'Error: INVALID_SESSION_ID: Invalid Session Id found in SessionHeader: Illegal Session'

All I got is some .NET working code, that I trying to covert and run as a webservice within Powerbuilder via WSDL downloaded from salesforce.com via soap connection.

Here is the Powerbuilder code that compiles well but gives error on query call that uses a soap connection with the right URL of soap preset.

=============F_CONNECT =================================
sl = create loginresult

try  
   
    SL = SF.login (l_user, l_pass)

    If SL.passwordExpired = False Then       
            sh = create sessionheader
            SH.sessionid =sl.sessionid
            sf.setsessionheadervalue( sh)                
                Return 0
            Else
             messagebox ("PB", "Failure to LOGIN to Web service")  
                Return 1
            End If

catch ( SoapException e )  
    messagebox ("Error", "Cannot invoke Web service")  
end try
 ======================================================
ACTUAL CALL
---------------------------------------------------------------------------------
sforcequeryoptions sqo
sforcequeryresult SQ
mytable__c SC
long i

i =f_connect(str_endpoint, sf_user, sf_pass)  
// no errors HERE on sf.login(user, pass) returns 0 and can see all data under sf when run from debugger.

sqo = create sforcequeryoptions
sqo.batchsize = 250
sqo.batchsizespecified = true

sf.setqueryoptionsvalue( sqo)   

sq = create sforcequeryresult b  //No errors till this point

SQ = sf.query("Select Name,ID FROM mytable__c WHERE OwnerID='xxxyyyzzz'" ) 

STOPS=====>> 'Error: INVALID_SESSION_ID: Invalid Session Id found in SessionHeader: Illegal Session'

//This SQL runs fine in .NET but gives INVALID_SESSION_ID error in PB and would not let me pass thru to next line

//Same EXACT SQL results in one record when tested elsewhere.
---------------------------------------------------------------------------------------------------------------------

I could not find code examples any where and wonders if anyone else did connect salesforce to powerbuilder successfully and pass on code example to me.

Thanks

Mel

PS: I did check the box for IP address specific sessions on SF sesson management

NeilBNeilB

Hi Mel1,

 

I'm having similar problems trying to change the sessionid after a successful login, did you ever get past this point in powerbuilder ?