Windows SharePoint Service 3.0 Search Query not working..

Last post 02-15-2008 12:59 PM by BassPassion. 4 replies.

Sort Posts:

  • Windows SharePoint Service 3.0 Search Query not working..

    04-02-2007, 8:37 AM
    • Member
      17 point Member
    • acacjag
    • Member since 10-12-2006, 5:43 AM
    • Posts 11

    I'm using the sample code comes with WSS 3.0 SDK see below..

     

    //The string containing the keyword to use in the search
    string keywordString = "Microsoft";
    //The XML string containing the query request information
    //for the Web service
    string qXMLString = "<QueryPacket xmlns='urn:Microsoft.Search.Query'>"+
    "<Query><SupportedFormats><Format revision='1'>"+
    "urn:Microsoft.Search.Response.Document:Document</Format>"+
    "</SupportedFormats><Context><QueryText language='en-US' type='STRING'>"+
    keywordString + "</QueryText></Context></Query></QueryPacket>";
    QueryWebServiceProxy.QueryService queryService = new QueryWebServiceProxy.QueryService();
    queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
    System.Data.DataSet queryResults = queryService.QueryEx(qXMLString);
    resultsGridView.DataSource = queryResults .Tables[0];

     

    But its throws exception like this...

    Server was unable to process request. ---> Attempted to perform an unauthorized operation.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Attempted to perform an unauthorized operation.

    Source Error:

    Line 142:        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:Microsoft.Search/Registration", RequestNamespace="urn:Microsoft.Search", ResponseNamespace="urn:Microsoft.Search", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    Line 143: public string Registration(string registrationXml) {
    Line 144: object[] results = this.Invoke("Registration", new object[] {
    Line 145: registrationXml});
    Line 146: return ((string)(results[0]));
     

    Can you help me in this?

    Thanks in advance.

    Jagad 

  • Re: Windows SharePoint Service 3.0 Search Query not working..

    04-02-2007, 10:02 AM

    Hi, you need to change the code to set the queryService PreAuthenticate to true and the URL property

            queryService.Credentials = System.Net.CredentialCache.DefaultCredentials;
            queryService.PreAuthenticate = true;
            queryService.Url = "http://localhost/_vti_bin/spsearch.asmx"; 

     Hope that helps.

     

    Steve

     

     

  • Re: Windows SharePoint Service 3.0 Search Query not working..

    04-03-2007, 12:41 AM
    • Member
      17 point Member
    • acacjag
    • Member since 10-12-2006, 5:43 AM
    • Posts 11

    Hi, Thanks for reply.

    But it throws same exception even after setting PreAuthenticate and Url properties.

    We have domain users for the SharePoint Portal and the same is working. Its working good, if I try to test service through IE(http://localhost/_vti_bin/spsearch.asmx). But through ASP.NET application it throws the exception.

     

    Should I set any explicit authentication for this? Help me in this.

     

    Thanks in advance.

    Jagad 

  • Re: Windows SharePoint Service 3.0 Search Query not working..

    11-01-2007, 11:38 PM
    • Member
      19 point Member
    • summer.hu
    • Member since 12-12-2004, 9:46 PM
    • Australia
    • Posts 5

    Hi,

    I meet the same problem when I use web service executing MOSS search, eventually I manually set IIS authentication to use only windows integrated authentication(uncheck the anonymoys thentication), then it is work.

    I think IIS always ignore the passing token if the anonymoys ahtntication is checked, so the taken passed from IIS to MOSS is the account running IIS(such as IIS_MachineName). That is why got security exception.

    Regards

     

     

  • Re: Windows SharePoint Service 3.0 Search Query not working..

    02-15-2008, 12:59 PM
    • Member
      2 point Member
    • BassPassion
    • Member since 08-30-2007, 7:40 AM
    • Posts 1

    Also add the following line in web.config

    <identity impersonate="true">

    /M

    http://www.InsomniacGeek.com
Page 1 of 1 (5 items)