0

我正在尝试转换旧的 CF 脚本。唯一的问题是我正在使用 CommandBox,我似乎无法让 Fiddler 向我展示这个请求在实际发布时的样子。有谁知道这发出的 Post 请求是什么样的?

到目前为止,我已经尝试了多种选择,但没有任何效果。

任何帮助,将不胜感激

<!--- 
    Cold Fusion 4.0.1
--->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


<html>
<head></head>

<body>

<cfif isdefined("Form.thisid")>
    <!--- Input Form Parameters --->
    <cfset InputPbn = Form.thisid>
    <cfoutput>
    <h1>Raw XML data for #thisid#</h1>
    </cfoutput>
<cfelse>
    <h1>A valid thisid was not provided</h1>
    <cfabort>
</cfif>


<!--- Assemble the user's input into structure --->

<CFSCRIPT>
    // New request structure to pass 
    Request = StructNew();
    
    Request.thisid = "#Inputthisid#";
    host_url = "http://myurl/get_info_wddx.cfm"; 

    Request["LINK_KEY"] = "1234";
    
</CFSCRIPT>

<!--- Convert the structure to WDDX Packet --->  

<CFWDDX 
    INPUT="#Request#"
    OUTPUT="RequestAsWDDX"
    ACTION="CFML2WDDX"
>

<cfoutput>RequestAsWDDX #HTMLEditFormat(RequestAsWDDX)#<br/></cfoutput>
<!--- Post the WDDX Packet to the host page as a form field --->

<CFTRY>
    <CFHTTP URL="#host_url#" METHOD="POST">
        <CFHTTPPARAM 
          NAME="WDDXContent" 
          VALUE="#RequestAsWDDX#" 
          TYPE="FORMFIELD"
        >
    </CFHTTP>
    <CFCATCH TYPE="Any">
        WDDX - HTTP Error<BR>
        <CFOUTPUT>#HTMLEditFormat(CFHTTP.FileContent)#</CFOUTPUT><BR>
        <CFABORT>
    </CFCATCH>
</CFTRY>
 
<!--- Extract recordset from WDDX Packet in host's response --->
<cfif FindNoCase("<META",CFHTTP.FileContent) >
    <cfset pos = FindNoCase(">",CFHTTP.FileContent)>
    <cfset wddx_strg = Right(CFHTTP.FileContent,(Len(CFHTTP.FileContent)-pos-1))>
<cfelse>
    <cfset wddx_strg = CFHTTP.FileContent>
</cfif>


...


</body>
</html>
4

1 回答 1

0

我严重过度复杂化了这个哈,只需要使用“WDDXContent”作为键,使用 WDDXContent 值作为值。

编辑:此时我没有代码,只是能够通过添加标题键“WDDXContent”和值来让提琴手重现它

<wddxPacket version='1.0'><header/><data><struct><var name='link_key'><string>1234</string></var><var name='id'><string>[id here]</string></var></struct></data></wddxPacket>
于 2020-11-20T18:44:23.080 回答