有没有办法输出CFHTTP
来电的原始html?我试图了解一些标头身份验证信息是如何发生的。
我对浏览器插件或代码更新持开放态度,这有助于我了解cfhttp
来电期间发生了什么。
例如:
<cfhttp method="get" url="https://test-ows01.mywebsite.com/criminal_api//1.0/service/requests" result="orderList">
<cfhttpparam type="HEADER" name="Authorization" value="Basic #ToBase64("bearer:4EC8B09D3F911764B1DCD3EFA38DFB31")#">
</cfhttp>
上述调用在发生时会是什么样子。
答案 0 :(得分:6)
如果我理解正确,听起来更像是想要查看发送到远程服务器的http请求,而不是收到的内容。 Installing a tool like Fiddler将提供非常强大的调试功能,允许您在发生http请求时查看它们。 (另请参阅Enable HTTPS traffic decryption的文档。)
提示快速调试,低技术黑客是将目标URL切换到服务器上的单独.cfm脚本。在脚本内部,转储GetHTTPRequestData()
,以显示发送到脚本的请求标头和正文。
<强> test.cfm 强>
dataGridView1.DataSource = bindingSource1;
GetData("SELECT [last_name] + ', ' + [first_name] AS [NAME], patient_id AS [CHART#], birth_date AS [DOB] FROM patient");
private void GetData(string selectCommand)
{
try
{
// Specify a connection string. Replace the given value with a
// valid connection string for a Northwind SQL Server sample
// database accessible to your system.
// Create a new data adapter based on the specified query.
dataAdapter = new OleDbDataAdapter(selectCommand, DQLCommon.ConnectionString);
// Create a command builder to generate SQL update, insert, and
// delete commands based on selectCommand. These are used to
// update the database.
OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(dataAdapter);
// Populate a new data table and bind it to the BindingSource.
DataTable table = new DataTable();
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter.Fill(table);
bindingSource1.DataSource = table;
DataGridViewColumn column1 = dataGridView1.Columns[0];
column1.Width = Convert.ToInt16(Convert.ToDouble(dataGridView1.Width) * 0.5);
DataGridViewColumn column2 = dataGridView1.Columns[1];
column2.Width = Convert.ToInt16(Convert.ToDouble(dataGridView1.Width) * 0.23);
DataGridViewColumn column3 = dataGridView1.Columns[2];
column3.Width = Convert.ToInt16(Convert.ToDouble(dataGridView1.Width) * 0.27);
}
catch (OleDbException)
{
MessageBox.Show("Failed in loading patient list.");
}
}
<强> receivingPage.cfm 强>
<cfhttp method="get" url="http://localhost/receivingPage.cfm" result="orderList">
<cfhttpparam type="HEADER" name="Authorization"
value="Basic #ToBase64("bearer:4EC8B09D3F911764B1DCD3EFA38DFB31")#">
</cfhttp>
答案 1 :(得分:0)
您可以使用requestcatcher.com。 它使您可以创建一个个人子域,然后可以将请求发送到该URL。非常便利。对我进行复杂的SOAP集成很有帮助。