4.5 GetSuggestedQueries

To obtain a list of suggested queries which contains the word "example", the protocol client sends a request message as follows:

 <?xml version="1.0" encoding="utf-8"?>
 <soap12:Envelope 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
   xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
   <soap12:Body>
     <GetQuerySuggestions 
       xmlns="http://microsoft.com/webservices/OfficeServer/QueryService">
       <queryXml>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;QueryPacket xmlns=&quot;urn:Microsoft.Search.Query&quot; Revision=&quot;1&quot;&gt;  &lt;Query domain=&quot;QDomain&quot;&gt;    &lt;Context&gt;      &lt;QueryText language=&quot;en-us&quot; type=&quot;STRING&quot;&gt;example&lt;/QueryText&gt;    &lt;/Context&gt;    &lt;Range&gt;      &lt;StartAt&gt;1&lt;/StartAt&gt;      &lt;Count&gt;8&lt;/Count&gt;    &lt;/Range&gt;    &lt;PreQuerySuggestions&gt;true&lt;/PreQuerySuggestions&gt;    &lt;HighlightQuerySuggestions&gt;false&lt;/HighlightQuerySuggestions&gt;  &lt;/Query&gt;&lt;/QueryPacket&gt;</queryXml>
     </GetQuerySuggestions>
   </soap12:Body>
</soap12:Envelope>

The request information in the preceding message is doubly encoded XML. The following shows the decoded value of the queryXml string:

 <?xml version="1.0" encoding="utf-8" ?>
 <QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1">
   <Query domain="QDomain">
     <Context>
       <QueryText language="en-us" type="STRING">example</QueryText>
     </Context>
     <Range>
       <StartAt>1</StartAt>
       <Count>8</Count>
     </Range>
     <PreQuerySuggestions>true</PreQuerySuggestions>
     <HighlightQuerySuggestions>false</HighlightQuerySuggestions>
   </Query>
 </QueryPacket>

The protocol server responds with a message such as this one:

 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope 
   xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
     <GetQuerySuggestionsResponse 
       xmlns="http://microsoft.com/webservices/OfficeServer/QueryService">
       <GetQuerySuggestionsResult>
         <string>example site</string>
         <string>client example</string>
         <string>server example</string>
         <string>example documents</string>
         <string>code example</string>
       </GetQuerySuggestionsResult>
     </GetQuerySuggestionsResponse>
   </soap:Body>
 </soap:Envelope>