SearchServer2008Express Search Webservice

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 xmlns='urn:Microsoft.Search.Query' 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
 
 
Print | posted on Friday, July 6, 2012 9:44 AM