
The third step of creating a data service is to specify your web service transformation rules. Given a particular set of web service output, you can specify an XSLT stylesheet to extract the desired data and represent it as DataRSS. This step is the heart of your data service.
Webservice Endpoint — Specifies the URL of the web service endpoint you wish to call, parameterized appropriately. The parameters you can pass in are listed above this field in curly braces.
?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<adjunctcontainer>
<adjunct id="smid:{$smid}" version="1.0">
<item rel="dc:subject" typeof="foaf:Organization" resource="{//artist/url}">
<meta property="dc:title"><xsl:value-of select="//artist/name"/></meta>
<item rel="foaf:depiction">
<item rel="foaf:thumbnail" resource="{//artist/image_small}" />
</item>
</item>
</adjunct>
</adjunctcontainer>
</xsl:template>
</xsl:stylesheet>
Output Format — Selects how to handle the web service's output.
OpenSearch — Indicates that the web service returns OpenSearch XML, which SearchMonkey can handle natively. For more information, refer to “Converting OpenSearch to DataRSS”.
Other — Indicates that the web service returns some other XML format, requiring an XSLT stylesheet to transform the web service output into valid DataRSS.
If you select Other, you must provide an appropriate stylesheet. For example, calling A simple stylesheet to transform the first, best match into DataRSS would be:
?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<adjunctcontainer>
<adjunct id="smid:{$smid}" version="1.0">
<item rel="dc:subject" typeof="foaf:Organization" resource="{//artist/url}">
<meta property="dc:title"><xsl:value-of select="//artist/name"/></meta>
<item rel="foaf:depiction">
<item rel="foaf:thumbnail" resource="{//artist/image_small}" />
</item>
</item>
</adjunct>
</adjunctcontainer>
</xsl:template>
</xsl:stylesheet>
Thus, if Jane Smith's home page appears in a search result, and if SearchMonkey is able to extract Jane's favorite band from the page, you could call Last.fm's web service and annotate the search result with related bands. "If Jane Smith likes Metallica, she might also like Megadeth..."
At the bottom of the screen is the Preview Pane, which displays the results of your data service for one of your test URLs.
If SearchMonkey's application works correctly, the
Preview Pane displays an HTML bulleted list of
name/value pairs representing the structure of the DataRSS for that web
service call. <item> rel attributes and
<meta> property attributes appear as
regular text, while literal <meta> values and the
values of resource attributes appear in bold. If there are
any problems with the transformation code, the Preview
Pane displays a bulleted list of warnings and errors.
The Preview Pane contains several controls for cycling through your test parameters and determining your data inputs and outputs:
— Saves any changes to
your XSLT and calls your data service again, displaying the results
in the Preview Pane. When you click
for the first time,
SearchMonkey fetches content for all of your test parameters, which
can cause a delay and a "Loading, Please Wait"
message.
— Displays a link to the web service endpoint being tested. The link opens the web service in a new window. Use this option to verify that your data service is retrieving the correct data from the correct web service.
— Cycle the Preview Pane through your test parameters, calling the web service endpoint with the next test set.
— Indicates which set of test parameters
of the total
N is being tested. You can
jump to any test set by clicking on the corresponding dot.M
— Displays the XML content of the web service being tested in a new window. Use this option to verify that the web service has the structure that you think it does.
— Displays the DataRSS XML output of the parameters being tested in a new window. Use this option to verify that your data service is producing the correct DataRSS.