SharePoint search service returns SERVER_ERROR (SQLException)

一个人想着一个人 提交于 2019-12-08 12:48:14

问题


I have a simple WCF webservice client that sends a request to Microsoft Search Server (included with SharePoint 2007) on /more/_vti_bin/search.asmx

The request is sent

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Query xmlns="urn:Microsoft.Search">
<queryXml>&lt;QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000"&gt; &lt;Query&gt; &lt;Context&gt; &lt;QueryText language="fr-FR" type="STRING"&gt;foo bar&lt;/QueryText&gt;&lt;/Context&gt; &lt;/Query&gt; &lt;/QueryPacket&gt; </queryXml>
</Query></s:Body></s:Envelope>

But the response shows a SQLException error

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<QueryResponse xmlns="urn:Microsoft.Search">
<QueryResult>&lt;ResponsePacket xmlns="urn:Microsoft.Search.Response"&gt;&lt;Response domain=""&gt;&lt;Status&gt;ERROR_SERVER&lt;/Status&gt;&lt;DebugErrorMessage&gt;System.Data.SqlClient.SqlException&lt;/DebugErrorMessage&gt;&lt;/Response&gt;&lt;/ResponsePacket&gt;</QueryResult>
</QueryResponse></soap:Body></soap:Envelope>

回答1:


It states there's been a sql exception, coulld you check on your sql machine if any errors occurred?




回答2:


there is a problem with your request. test your search service using this tool




回答3:


After some further analysis, I have understood that the problem lies in the fact that the Soap query does not start with an XML declaration.

<?xml version="1.0">

This is perfectly possible and respectful of standards but SharePoint doesn't like that.

The question becomes: How to force the WCF client to starts with an XML declaration.



来源:https://stackoverflow.com/questions/4750238/sharepoint-search-service-returns-server-error-sqlexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!