Bad Session Object

Forum for users and developers of Bullhorn's Webservices API suite

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
nquinn
User
Posts: 5
Joined: Fri Apr 04, 2014 12:31 pm

Bad Session Object

Post by nquinn » Wed May 21, 2014 8:10 pm

Hi:

I am trying to convert from Webservices 1.1 to 2.5. I changed the API_com_bullhornstaffing_api_ApiService to use 2.5. When I do that I get a Bad session object error while trying to read the jobs RSS feed.

ApiService service = new ApiService();
apiSession currentSession = new apiSession();
currentSession = service.startSession(Globals.username, Globals.password, Globals.apiKey);
dtoQuery jobsQuery = new dtoQuery();
jobsQuery.entityName = "JobOrder";
jobsQuery.maxResults = cnt;
jobsQuery.maxResultsSpecified = true;
jobsQuery.where = "isDeleted = 0 and dateclosed is null and isOpen = 1 and isPublic = 1";
String[] myStringArray = new String[1];
myStringArray[0] = "dateAdded desc";

jobsQuery.orderBys = myStringArray;
apiQueryResult queryResult = service.query(currentSession, jobsQuery);
This is the line that throws the bad session object error.

Can you let me know what needs to be changed?

s.emmons
User
Posts: 333
Joined: Wed Dec 31, 1969 8:00 pm

Re: Bad Session Object

Post by s.emmons » Mon Jun 09, 2014 12:50 pm

Hi nquinn,

You need to amend how you are passing the session in each API request, as there is a difference between 1.1 and 2.5 in this respect.

Session Response from WebServices 1.1

Code: Select all

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:startSessionResponse xmlns:ns2="http://apiservice.bullhorn.com/">
         <return>
            <client>rO0ABXNyACpjb20uYnVsbGhvcm4uZGF0YXNlcnZpY2UuYXBpLkFwaURhdGFDbGllbnQAAAAAAAAA
AQIACEoACmxhc3RBY2Nlc3NJAA5zdXBlckNsdXN0ZXJJZEwADWNvcnBvcmF0aW9uSWR0ABNMamF2
YS9sYW5nL0ludGVnZXI7TAAGZGJOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7TAAMbWFzdGVyVXNl
cklkcQB+AAFMAA5wcml2YXRlTGFiZWxJZHEAfgABTABGdXNlcklkcQB+AAFMAAp1c2VyVHlwZUlk
cQB+AAF4cAAAAUaBhgjHAAAAAXNyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFs
dWV4cgAQamF2YS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAAZqdAAMQlVMTEhPUk4xNzA0c3EA
fgAEAE4u1HNxAH4ABAAACUZzcQB+AAQAAAgkc3EAfgAEAAAguw==</client>
            <corporationId>XXXX</corporationId>
            <userId>XXXX</userId>
         </return>
      </ns2:startSessionResponse>
   </S:Body>
</S:Envelope>
Session Response from WebServices 2.5

Code: Select all

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:startSessionResponse xmlns:ns2="http://apiservice.bullhorn.com/">
         <return>
            <session>rO0ABXVyAAJbQqzzF/gGCFTgAgAAeHAAAAJQQWDNEEEPh2aRf95krKChDQk2Q50HVbTHcjXh3Zfu
UT5EzcGa3rWxd7RhJB1PlBquvZEbR9yZIzDOrj3VyNk+BKluBdlziIfayqZG/+DugQLSfjXpVjXj
tgx/vrTBosA1bcrEAfnEsdRh8Qno5+0LedCchYxTSU8iZQhNkN1mX5fM7O++ucHN7BFGD2Ltv3e2
6htwVAfOcvQ3Fl7l8Wi5sP8+yl8nL+Jz3byw8cAyarNTAOcTPGlhGq7pc7Y4xONWkUcmPJYMWxna
zgdbDEB/xzh7UvCovuCPxnTA9FCeNlc2JDlVe8QEbNlaj0PbTeVLOol2wcH1PH9P48bAN4arrmz3
zyLn0J1sPMB7dcBvlDH934GnWAUSe97W1ogrg3mpxhDGbkS9s6ihJi88vLV6TmhdUm84j5dfg6tQ
YnOQcuQjFgVSMyg8wHuXcFPdCLY0G60sG3PfyewQtAQ3dt3XD2pJhjMh67LSJwonZO0SGspi/ICC
pgxvAxqai+pnaT9oldrzIEmqZZWiQV+dLP9ss+UFIVmik4DmH44+cYuD3gzAisdmHb5jxi+18PxJ
RXUfdhA/VWhdF88glewC8I8RYDevaSWXBUesR5VDLbDfSzdurHQ4W5OauIzGaY+zJ4ORiTgg/weH
xHpZC4qrIEDbYjXO9W4ZbIFce1hDn3xSpzZVgEb7pfnZpQszVCqc61l5CIx9FH2yCQGEhZkSuBII
zwF0Dc4HlnLK2Ryam2NgyW7/PoUgItAtNkiQzjzzTpEEG0PMm3DrN6FC8l4BnSJ38w==</session>
            <corporationId>XXXX</corporationId>
            <userId>XXX</userId>
         </return>
      </ns2:startSessionResponse>
   </S:Body>
</S:Envelope>
In 1.1, you needed to provide the client, corporationId and userId within the session parameter. In 2.5, you can just pass the value returned for <session> as the session paramter for subsequent API calls.

If you have any questions, please let me know!
Sam Emmons
Enterprise Team Lead
BULLHORN
US Support 617-478-9126

Post Reply