Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用使用ColdFusion返回JSON数据的SOAP API_Json_Api_Soap_Coldfusion - Fatal编程技术网

使用使用ColdFusion返回JSON数据的SOAP API

使用使用ColdFusion返回JSON数据的SOAP API,json,api,soap,coldfusion,Json,Api,Soap,Coldfusion,我得到了一个URL,该URL应该返回一些JSON数据,其中包含一个oAuth令牌来访问API的其余部分。API调用使用GET,并在URL中包含用户名和密码 当我尝试访问API的URL时,会收到以下消息: error unauthorized error_description An Authentication object was not found in the SecurityContext <CFHTTP URL="https://test-ows01.website.c

我得到了一个URL,该URL应该返回一些JSON数据,其中包含一个oAuth令牌来访问API的其余部分。API调用使用GET,并在URL中包含用户名和密码

当我尝试访问API的URL时,会收到以下消息:

error   unauthorized
error_description   An Authentication object was not found in the SecurityContext
<CFHTTP URL="https://test-ows01.website.com/data_api//1.0/oauth/token?grant_type=password&username=HelloWorld&password=MyPassword!" method="GET" result="result">
</CFHTTP>

<cfset content = deserializeJSON(result.filecontent.toString())>

<cfdump var="#content#">
下面是我的ColdFusion示例:

error   unauthorized
error_description   An Authentication object was not found in the SecurityContext
<CFHTTP URL="https://test-ows01.website.com/data_api//1.0/oauth/token?grant_type=password&username=HelloWorld&password=MyPassword!" method="GET" result="result">
</CFHTTP>

<cfset content = deserializeJSON(result.filecontent.toString())>

<cfdump var="#content#">

其他信息:当我将URL(这不是该问题的正确URL)放入浏览器时,我会得到“登录”提示,然后输入用户名:HelloWorld和密码:MyPassword!然后,我进入一个页面,该页面显示JSON数据,其中包含oAuth令牌和其他数据


我得到了一个SOAPUI文件,所以请查看API是如何工作的,这样如果我需要提供一些其他信息,我就可以从那里获取它

您连接到的服务器在请求过程中需要身份验证凭据。将用户名和密码添加到
cfhttp
标记中,以在请求中发送凭据

<cfhttp  url="example.com/data_api//1.0/oauth/token?grant_type=password" method="GET" result="result" 
    username="HelloWorld" password="MyPassword!">
</cfhttp>


如果我的问题将被否决,请留下一条评论,说明我遗漏了什么或否决投票的原因。谢谢。我没有看到soap信封被发送到URL,因此您可能没有使用web服务的soap端点。给定登录提示,请求可能还需要基本身份验证。可能还需要基本身份验证。。。ie尝试使用cfhttp的“username”和“password”属性,而不是将用户名和密码作为URL参数传递。最后两条注释是正确的。我与另一位开发人员进行了交谈,他确认在调用API之前需要进行基本身份验证。一个-谢谢,但我只是详细阐述了@Twillen关于基本身份验证的建议(我很确定他们的意思是:)如果解决了问题,Twillen应该将其作为“答案”发布谢谢这正是我想要的+1检查。