根级别的数据无效

时间:2021-09-16 18:34:14

Having a major headache while trying to call a webservice. (Search Server Express) The error is: Data at the root level is invalid

在尝试呼叫Web服务时遇到了严重的问题。 (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 个解决方案

#1


1  

I would suggest that it is perhaps expecting a root level node and you having your data at the root level is invalid.

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

Try this

尝试这个

<?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>

#1


1  

I would suggest that it is perhaps expecting a root level node and you having your data at the root level is invalid.

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

Try this

尝试这个

<?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>