2012-03-13 103 views
3

我開始使用Coldfusion 8處理擴音器SOAP webservice集成。我遇到了身份驗證問題 - 獲取會話。 我試着做它喜歡有人做here使用Coldfusion與Bullhorn SOAP webservice API集成

<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> 

我已經更換了1.1端點與2.0 Web服務端點。 startSession()工作正常,但我應該使用getSession()獲取會話值,但它在返回的對象中不可用 - 這是父類的函數。

enter image description here

我使用bhSession.super.getSession()嘗試過,但沒有任何工作。

我會很感激的任何建議如何處理這個整合:

  • 我要離開CFINVOKE/CREATEOBJECT完全並繼續 CFHTTP和手工製作肥皂信封?

  • 或者可能使用一些Java庫來進行集成?

  • 或者可能使用1.1版本的API?


SOAP響應我開始使用的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> 

一切都很好那裏。似乎手動方式將是正確的解決方案。

感謝您的幫助。
Lucas

回答

2

最終發現它。

應該使用GetSOAPResponse來獲得實際響應。

示例代碼,如果有人有興趣:

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

的sessionResult將包含所需的XML。