Reputation: 1
Having a major headache while trying to call a webservice. (Search Server Express) The error is: Data at the root level is invalid
<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>
Upvotes: 0
Views: 3281
Reputation: 4758
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>
Upvotes: 1