根级别的数据无效

时间:2012-01-19 19:15:04

标签: xml soap coldfusion

在尝试呼叫网络服务时遇到了严重的问题。 (Search Server Express) 错误是:根级别的数据无效

    <cfoutput>
    <cfsavecontent variable="xmlBody">
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">      
        <soap:Body>
            <Query xmlns="urn:Microsoft.Search">
                <queryXml>xml</queryXml>
            </Query>
        </soap:Body>
    </soap:Envelope>
    </cfsavecontent>
    <cfhttp url="http://server_name/_vti_bin/Search.asmx" method="POST" result="httpResponse">
    <cfhttpparam type="header" name="Host" value="server_name"/>
    <cfhttpparam type="header" name="content-type" value="text/xml; charset=utf-8"/> 
    <cfhttpparam type="header" name="content-length" value="#len(trim(xmlBody))#"/>
    <cfhttpparam type="header" name="SOAPAction" value="urn:Microsoft.Search/Query"/>

    <cfhttpparam type="xml" value="#trim(xmlBody)#" />
    </cfhttp>
    </cfoutput>

1 个答案:

答案 0 :(得分:1)

我建议它可能期望一个根级别节点,并且您在根级别的数据无效。

试试这个

<?xml version="1.0" encoding="utf-8"?>
<root>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">      
        <soap:Body>
            <Query xmlns="urn:Microsoft.Search">
                <queryXml>xml</queryXml>
            </Query>
        </soap:Body>
    </soap:Envelope>
</root>