代码之家  ›  专栏  ›  技术社区  ›  Geo

CFML2WDX错误ColdFusion 11

  •  3
  • Geo  · 技术社区  · 9 年前

    我正在使用 CFM2WDDX 转换CF11中的数组,但我遇到了以下错误:

    coldfusion.tagext.validation.WddxValidator$InvalidWddxPacketException: WDDX数据包无效。。

    我在这里使用此代码:

    获取文件列表.cfm

    <cfsetting enablecfoutputonly="Yes">
    <cfset thisdir = ExpandPath(".\")>
    <cfdirectory directory="#thisdir#" action="LIST" name="imagefiles" recurse="No">
    <cfscript>
    // get .gif|.jpg|.png files from the cfdirectory query...
    numRows = imagefiles.recordcount;
    imageFileArray = ArrayNew(1);
    for (row = 1; row LTE numRows; row++) {
        if (refindnocase("(.gif|.jpg|.png)",imagefiles.name[row]) neq 0) {
            ArrayAppend(imageFileArray, imagefiles.name[row]);
        }    
    }
    </cfscript>
    <cfwddx action="cfml2wddx" input=#imageFileArray# output="wddxText">
    <cfoutput>#wddxText#</cfoutput>
    

    正如你所看到的,代码创建了一个图像名称数组,然后我通过cfhttp访问它,以执行我需要的任何操作。我在CF9服务器上有相同的精确代码,具有相同的精确目录内容,工作正常,但在CF11中,我收到了格式错误。CF11中的这一功能是否发生了某种变化?

    这是我用来访问上述代码的代码:

    <cfhttp url="http://example.com/images/ClientLogos/getFileList.cfm" method="GET" timeout="10" throwonerror="Yes">
        <cfwddx action="WDDX2CFML" input="#trim(cfhttp.filecontent)#" output="imageArray" validate="true">
        <cfreturn imageArray>
    

    这个 getFileList.cfm 与映像位于同一目录中,因此它在从中调用的本地服务器上执行。(这就是为什么我认为CF11可能是问题所在)

    CF9的部分输出:

    enter image description here

    CF11的部分输出:

    enter image description here

    来自CF 11的CFHTTP.Header:

    HTTP/1.1 200 OK Content-Type: text/html;charset=UTF-8 Server: Microsoft-IIS/8.0 X-Powered-By: ASP.NET Access-Control-Allow-Origin: * Date: Tue, 31 Mar 2015 18:50:35 GMT Connection: close Content-Length: 10807 
    

    来自CF 9的CFHTTP.Header:

    HTTP/1.1 200 OK Content-Type: text/html; charset=UTF-8 Vary: Accept-Encoding Server: Microsoft-IIS/7.5 X-Powered-By: ASP.NET Date: Tue, 31 Mar 2015 18:51:20 GMT Connection: close
    

    1 回复  |  直到 9 年前
        1
  •  0
  •   Geo    9 年前

    我不确定是什么导致了这种行为,但我现在找到了一个中间点。我没有通过cfhttp调用getFileList.cfm,而是将getFileList.chm中的代码直接移到函数内部,一切都正常。以该文件开头的原因是允许我访问不同服务器上的外部图像存储库,而我不再需要/使用该存储库。不管怎样,这实际上可能是一个CF11错误,所以我们将在未来看到。。。

    推荐文章