Problem:

You want to create a data source in SharePoint Designer 2010 that queries the search web service and returns the results. You might hit this scenario if, for instance, you want to use the DataFormWebPart to query the search service and use XSLT to transform and display the results.

Solution:

First I’ll just say the process of setting up a data source against the search web service in SharePoint Designer isn’t quite as intuitive as you might expect, and it’s not well documented, either. So if you’ve run into problems doing it, you’re not alone.

Here are the steps:

1.       Open your site in SharePoint Designer.

2.       Click the “Data Sources” node in the Site Objects pane.

3.       Click the “SOAP Service Connection” button in the New group on the ribbon.

4.       You should be presented with the dialog box in Figure 1:

 

5.       Type http://\\{SiteUrl\\}/_vti_bin/search.asmx?WSDL into the “Service Description Location” field and click the Reconnect button.

6.       For the “Select which data command to configure” field, choose the SELECT command.

7.       Leave the default port (unless you have a reason to change it).

8.       For the “operation” field, choose either Query or QueryEx. Documentation on those operations can be found here at the MSDN page "Query Service Methods." Both operations take a parameter named queryXml.

9.       Highlight the queryXml parameter in the Parameters list and click the Modify button. The dialog you see should look like Figure 2

 

.

 

10.   Now here’s the trick: The query XML you type or paste as the parameter value must be on a single line and must escape the ‘<’ and ‘>’ characters (as &lt; and &gt;). If you’re a normal human being and don’t have the query syntax memorized, it’s documented at the MSDN page "Building Search Queries."  

However, you can also use something like the SharePoint Search Service Tool at Codeplex.com  to generate your query. I usually use a tool to generate my queries and then use the “find and replace” feature of a text editor to escape the angle brackets.

11.   Click OK to save your parameter value, and click OK again on the first dialog to save the data source.

That’s it! Now you have a data source pointing at the search web service that you can use elsewhere in SharePoint Designer.

Read more SharePoint Q & A's :

SharePoint Q&A: Attempting to Configure Search Scope Settings for a Site Collection Throws an Error

SharePoint Q&A: How do I configure a load balancer to accept only SSL requests for a SharePoint 2010 FQDNs?

SharePoint Q&A: How Do I Apply a Filter Based on a URL to an External List?

SharePoint Q &A: How Do I Propagate BDC Model Updates to an Entity Picker to Resolve the "Parameter is Missing" Error?

 

SharePoint Q&A: How Do I Smoothly Deploy Reports Hosted in SharePoint?

Sharepoint Q&A: How Can I Create an External List When SharePoint Throws an Unspecfied ASP.NET Error?

SharePoint Q &A: InfoPath Designer 2010 message says By default this control will send data to the server whenever its value changes

SharePoint Q&A: How do I display a user-friendly value?

SharePoint Q&A: How do I display a more user-friendly error message?

SharePoint Q&A: How do I submit the InfoPath 2010 form programmatically to an external list?

Sharepoint Q&A: How Can I Create an Action for an External Content Type in SharePoint?

Sharepoint Q&A: How to Make a Type String Type Descriptor a Required Field in the BDC Explorer

Sharepoint Q&A: Data Source Conflict