简体   繁体   English

使用Coldfusion与Bullhorn SOAP webservice API集成

[英]Integration with Bullhorn SOAP webservice API using Coldfusion

I'm starting to work on the Bullhorn SOAP webservice integration using Coldfusion 8. I'm having problems with authentication - getting the session. 我开始使用Coldfusion 8进行Bullhorn SOAP Web服务集成。我遇到了身份验证问题 - 获取会话。 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've replaced the 1.1 endpoint with 2.0 webservice endpoint. 我用2.0 webservice端点替换了1.1端点。 startSession() works all right, but I'm supposed to get session value using getSession(), but it's not available in the object returned - it's a function from parent class. startSession()可以正常工作,但我应该使用getSession()来获取会话值,但它在返回的对象中不可用 - 它是来自父类的函数。

在此输入图像描述

I've tried using bhSession.super.getSession() but that didn't work either. 我尝试过使用bhSession.super.getSession(),但是也没用。

I'd be grateful for any suggestion how to approach this integration: 对于如何处理这种集成的任何建议,我将不胜感激:

  • should I leave cfinvoke/createObject completely and continue with CFHTTP and making the soap envelopes by hand? 我应该完全离开cfinvoke / createObject并继续使用CFHTTP并手工制作肥皂信封吗?

  • or maybe use some Java library to do the integration? 或者可能使用一些Java库来进行集成?

  • or maybe use the 1.1 version of the API? 或者可能使用1.1版本的API?


SOAP response I get using soapUI: 我使用soapUI的SOAP响应:

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

All is fine there. 一切都很好。 Seems that the manual way would be the right solution. 似乎手动方式是正确的解决方案。

Thanks for your help. 谢谢你的帮助。
Lucas 卢卡斯

Figured it out in the end. 最后想出来了。

Should have used GetSOAPResponse to get the actual response. 应该使用GetSOAPResponse来获取实际响应。

Example code if someone 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 XML needed. sessionResult将包含所需的XML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM