I have a query that I have used with Sharepoint 2003 (which works),
however I am receiving and error when I use the same source code to
call MOSS 2007.
Here is the code:
public void Search(string searchString, string user, ReplyResults
replyResultCallback, object asyncState)
{
Search.QueryService search = new Search.QueryService();
string domain = "";
if (username.Contains(@"\"))
{
string[] temp = username.Split(new char[] { '\\' });
domain = temp[0];
username = temp[1];
}
string decodedPass = EncryptDecrypt.Decrypt(password,
encryptionKey);
System.Net.NetworkCredential nc = new
System.Net.NetworkCredential(username, decodedPass, domain);
search.Credentials = nc;
if (disableCertChecking)
ServicePointManager.CertificatePolicy = new
AcceptAllCertificatePolicy();
try
{
DataSet results = search.QueryEx(
"<?xml version='1.0' encoding='utf-8' ?>" +
"<QueryPacket xmlns='urn:Microsoft.Search.Query'
Revision='1000'>" +
"<Query domain='QDomain'>" +
"<SupportedFormats><Format
revision='1'>urn:Microsoft.Search.Response.Document.Document</Format><
/SupportedFormats>" +
"<Context>" +
"<QueryText language='en-US'
type='STRING'> " +
searchString +
"</QueryText>" +
"</Context>" +
"<Range><StartAt>1</StartAt><Count>1500</C
ount></Range>" +
"</Query>" +
"</QueryPacket>");
...
It throws this exception with the call to QueryEx.
Here is the error:
System.Web.Services.Protocols.SoapException: Server did not recognize
the value of HTTP Header SOAPAction:
microsoft.com/.../WebQueryServic
e/QueryEx.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse
(SoapClientMessage message, WebResponse response, Stream
responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
(String methodName, Object[] parameters)
at Emc.RttcWsmr.Search.QueryService.QueryEx(String queryXml)
at Emc.RttcWsmr.Controller.SharepointDataRetrieval.Search(String
searchString, String user, ReplyResults replyResultCallback, Object
asyncState)
I have reworked the query many times - and I can't get anything to
work.
Does anyone have any answers or hints or clues what is wrong? Please
give me a hand.
Do you know someone who can help? Share a link to this thread on twitter, or facebook.