Integration with Bullhorn SOAP webservice API using Coldfusion

I am starting to work on integrating SOAP Bullhorn web services using Coldfusion 8. I am having problems with authentication - getting session. I've tried doing it like someone did here :

<cfset   session_arg   =   structnew()>
<cfset   session_arg.username   =   'xxxxxx'>
<cfset   session_arg.password   =   'xxxxxxx'>
<cfset   session_arg.apiKey      =   'xxxxxxxxxxxxxxxxxxxxxxx'>

<cfinvoke
           webservice         =   "https://api.bullhornstaffing.com/webservices-2.0/?wsdl"
           method            =   "startSession"
           returnvariable      =   "bhSession"
           argumentcollection   =   "#session_arg#">
</cfinvoke>

      

I replaced the 1.1 endpoint with the webservice 2.0 access point. startSession () is working all right, but I have to get the session value using getSession (), but it is not available in the returned object - this is a function from the parent class.

enter image description here

I tried using bhSession.super.getSession () but that didn't work either.

I would be grateful for any suggestion on how to approach this integration:

  • Should I completely leave cfinvoke / createObject and continue with CFHTTP and make soap envelopes manually?

  • or maybe use some Java library for the integration?

  • or maybe use API version 1.1.


SOAP response I am getting using soapUI:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:startSessionResponse xmlns:ns2="http://apiservice.bullhorn.com/">
         <return>
            <session>THE_SESSION_VAR</session>
            <corporationId>COPRPORATION_ID</corporationId>
            <userId>USER_ID</userId>
         </return>
      </ns2:startSessionResponse>
   </S:Body>
</S:Envelope>

      

Everything is good. It seems like the right way would be the right decision.

Thank you for your help. Lucas

+3


source to share


1 answer


It turned out that at the end.

Must use GetSOAPResponse to get actual response.

Sample code if anyone is interested:



<cfscript>
    webservice = createObject("webservice", "https://api.bullhornstaffing.com/webservices-2.0/?wsdl");
    webservice.startSession(myUsername, myPassword, myAPIKey);
    sessionResult = GetSOAPResponse(webservice);
</cfscript>

      

The SessionResult will contain the required XML.

+2


source







All Articles