SharePoint Designers allows to create a data source based on a web service, and then use this data source in a page.
Let’s say you want to display search results in a page. To do so you can use the QueryEx method of the search.asmx web service. This method takes 1 parameter, queryXml, which is an XML representation of a query.
To create the datasource, you click on Data Sources > SOAP Service Connection (in the ribbon). This window appears:
In the Service description location field, type the URL of the search web service. For example: http://yvandev10:6000/_vti_bin/search.asmx?WSDL and click “Connect Now”.
In the parameters, queryXml attribute appears so you can set its value by clicking on “Modify”.
Normally, queryXml looks like the following:
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000"> <Query domain="QDomain"> <SupportedFormats> <Format>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(Description, 'SharePoint') AND "Scope" = 'All Sites'</QueryText> </Context> <Range><StartAt>1</StartAt><Count>20</Count></Range> <EnableStemming>false</EnableStemming> <TrimDuplicates>true</TrimDuplicates> <IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery> <ImplicitAndBehavior>true</ImplicitAndBehavior> <IncludeRelevanceResults>true</IncludeRelevanceResults> <IncludeSpecialTermResults>true</IncludeSpecialTermResults> <IncludeHighConfidenceResults>true</IncludeHighConfidenceResults> </Query> </QueryPacket>
But there is a trick to use it in SharePoint Designer: you have to encode XML special character, and put the whole query in 1 line. So it results in the following:
<QueryPacket xmlns="urn:Microsoft.Search.Query" Revision="1000"> <Query domain="QDomain"> <SupportedFormats> <Format>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(Description, 'SharePoint') AND "Scope" = 'All Sites'</QueryText> </Context> <Range><StartAt>1</StartAt><Count>20</Count></Range> <EnableStemming>false</EnableStemming> <TrimDuplicates>true</TrimDuplicates> <IgnoreAllNoiseQuery>true</IgnoreAllNoiseQuery> <ImplicitAndBehavior>true</ImplicitAndBehavior> <IncludeRelevanceResults>true</IncludeRelevanceResults> <IncludeSpecialTermResults>true</IncludeSpecialTermResults> <IncludeHighConfidenceResults>true</IncludeHighConfidenceResults> </Query> </QueryPacket>
that you can type in the queryXml value:
A list of special characters and their encoded value can be found in this article: http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references. Notepad++ is a good tool to encode string quickly: select the string > TextFX > TextFX Convert > Encore HTML (&<>”).
Finally, you can use the data source in a page through a DataView control. If connection to web service was successful
If you get an HTTP 500 response instead, the queryXml value is likely not set correctly.