SearchServer2008Express Search Webservice

Posted by Mike Koerner on Geeks with Blogs See other posts from Geeks with Blogs or by Mike Koerner
Published on Fri, 06 Jul 2012 15:44:56 GMT Indexed on 2012/07/10 15:17 UTC
Read the original article Hit count: 270

Filed under:
I was working on calling the Search Server 2008 Express search webservice from Powershell.  I kept getting

 <ResponsePacket xmlns="urn:Microsoft.Search.Response"><Response domain=""><Status>ERROR_NO_RESPONSE</Status><DebugErrorMessage>The search request was unable to connect to the Search Service.</DebugErrorMessage></Response></ResponsePacket>

I checked the user authorization, the webservice search status, even the WSDL.  

Turns out the URL for the SearchServer2008 search webservice was incorrect.  I was calling 
$URI= "http://ss2008/_vti_bin/spsearch.asmx?WSDL"
and it should have been
$URI= "http://ss2008/_vti_bin/search.asmx?WSDL"


Here is my sample powershell script:
# WSS Documentation http://msdn.microsoft.com/en-us/library/bb862916.aspx

$error.clear()

#Bad SearchServer2008Express Search URL 
$URI= "http://ss2008/_vti_bin/spsearch.asmx?WSDL"
#Good SearchServer2008Express Search URL 
$URI= "http://ss2008/_vti_bin/search.asmx?WSDL"

$search = New-WebServiceProxy -uri $URI -namespace WSS -class Search -UseDefaultCredential 

$queryXml = "<QueryPacket Revision='1000'>
  <Query >
    <SupportedFormats>
      <Format revision='1'>urn:Microsoft.Search.Response.Document.Document</Format>
    </SupportedFormats>
    <Context>
      <QueryText language='en-US' type='MSSQLFT'>SELECT Title, Path, Description, Write, Rank, Size FROM Scope() WHERE CONTAINS('Microsoft')</QueryText>
      <!--<QueryText language='en-US' type='TEXT'>Microsoft</QueryText> -->
    </Context>
  </Query>
</QueryPacket>"
 
$statusResponse = $search.Status()
write-host '$statusResponse:'  $statusResponse
 
$GetPortalSearchInfo = $search.GetPortalSearchInfo()
write-host '$GetPortalSearchInfo:'  $GetPortalSearchInfo
 
$queryResult = $search.Query($queryXml)
write-host '$queryResult:'  $queryResult
 
 

© Geeks with Blogs or respective owner