3

我觉得自己像个傻瓜,没有弄清楚这一点。我有coldfusion webservice(bluedragon7)来接受来自合作伙伴的信息。他们在结果字段中传递 xml,它只在参数中显示 accessionNumber 的第一个元素。如果我将参数类型更改为其他任何类型(任何、字符串等),则会引发 500 个错误。我在这里错过了什么吗?

这是该函数的一个片段:

<cffunction access="remote" name="result" output="false" returntype="any" hint="">
<cfargument name="userid" type="string" required="yes" hint="userid">
<cfargument name="password" type="string" required="yes" hint="password">
<cfargument name="result" type="xml" required="Yes" default="result">
</cffunction>  

这是他们的帖子示例:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header />
<soapenv:Body>
    <result xmlns="http://cws.ots.labcorp.com">
        <userId>peter265974</userId>
        <password>pwd265974</password>
        <result>
            <accessionNumber>0572854881</accessionNumber>
            <accountLocationCode>000010</accountLocationCode>
            <accountLocationName>AERO CONTROL</accountLocationName>
            <accountLocationPhone>2537353350</accountLocationPhone>
            <accountName>HEALTHFORCE PARTNERS CORPORATE</accountName>
            <accountNumber>000804</accountNumber>
            <collectorCOCcomments>
                <abbreviation />
                <commentText>100154550. TEST OF VIEWING CO</commentText>
                <commentType>MS</commentType>
            </collectorCOCcomments>
        </result>
    </result>
</soapenv:Body>

4

1 回答 1

0

我只是有同样的问题。我试图遍历所有元素,同时检查元素是否仍然具有“xmlchild”。也许我的线程可以在这里提供帮助。

但是您必须更改行,您的正文内容将保存在 var 中

<cfset var body = xmlsearch(cont, "//SOAP-ENV:Body")[1] />

只需插入“soapenv:Body”而不是“SOAP-ENV:Body”

于 2012-07-04T11:20:18.000 回答