This discussion is archived
3 Replies Latest reply: Aug 21, 2012 7:18 AM by Roger Ford RSS

Consuming data from an external web service

927738 Newbie
Currently Being Moderated
Hello,
We want to integrate another program's search engine (PLM for the matter),
and in order to do that we want to know what are the options for consuming data from an external web service, as we have "wrapped" this search engine in a web service and we want to consume the data found from this web service (the SES will only be the display of the results passed by the web service )
Or alternativley if there is another known method to do that..

Thanks,
Liora.
  • 1. Re: Consuming data from an external web service
    Roger Ford Expert
    Currently Being Moderated
    Have a look at the "Suggested Content" feature.
  • 2. Re: Consuming data from an external web service
    927738 Newbie
    Currently Being Moderated
    I am familiar with this feature,
    and it is unclear how exactly to configure a web service source- how to connect the SES to a web service for a "send request and recieve response" interaction.

    more details will be much appreciated.

    Thanks again,
    Liora
  • 3. Re: Consuming data from an external web service
    Roger Ford Expert
    Currently Being Moderated
    In the SES admin interface under Suggested Content, you need to provide:
    1/ Provider name (your choice)
    2/ Query pattern - for example :
    weather (.*)
    would send any words following the term "weather" to the suggested content provider
    3/ Provider URL: A URL for the web service, where certain values can be replaced by SES variables. For example:
    http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=XXX&query=$ora:q&results=3
    Calls the Yahoo web service API with the searchterms ($ora:q) as the "query" parameter
    4/ An XSLT style sheet which processes the output from the web service in the format you want it displayed.
    Unfortunately the Yahoo search web service has been shut down, but this is the XSLT I used to use with it:
    <!--
    Provider Name: Yahoo!
    Query Pattern: (.*)
    Provider URL: http://search.yahooapis.com/WebSearchService/V1/webSearch?appid=XXX&query=$ora:q&results=3
    -->
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                    xmlns:fo="http://www.w3.org/1999/XSL/Format"
                    xmlns:xs="http://www.w3.org/2001/XMLSchema"
                    xmlns:fn="http://www.w3.org/2005/xpath-functions"
                    xmlns:yahoo="urn:yahoo:srch">
      <xsl:variable name="imageURL">http://us.i1.yimg.com/us.yimg.com/i/us/my/bn/ylinksy_l.gif</xsl:variable>
      <xsl:variable name="baseSearchURL">http://search.yahoo.com/search</xsl:variable>
      <xsl:variable name="queryParam">p</xsl:variable>
      <xsl:preserve-space elements="*"/>
      <xsl:output method="html" omit-xml-declaration="yes" encoding="UTF-8"/>
      <xsl:template match="/yahoo:ResultSet">
        <xsl:if test="number(@totalResultsReturned) &gt; 0">
          <table width="100%" style="background-color:white;">
            <tr>
                <td width="150" align="center">
                  <a>
                    <xsl:attribute name="href">
                      <xsl:value-of select="concat('http://search.yahoo.com/search?p=',substring-before(substring-after(@moreSearch,'='),'&amp;'))"/>
                    </xsl:attribute>
                      <img border="0" src="{$imageURL}"/>
                  </a>
                </td>
              <td>
                <table>
                  <xsl:for-each select="yahoo:Result">
                    <tr>
                      <td>
                        <font size="-1">
                          <a>
                            <xsl:attribute name="href">
                              <xsl:value-of select="yahoo:Url"/>
                            </xsl:attribute>
                            <xsl:value-of select="yahoo:Title"
                                          disable-output-escaping="no"/>
                          </a>
                        </font>
                        <font color="#008000" size="-1">
                          <xsl:text> - </xsl:text>
                          <xsl:value-of select="yahoo:DisplayUrl"/>
                        </font>
                      </td>
                    </tr>
                  </xsl:for-each>
                </table>
              </td>
            </tr>
          </table>
        </xsl:if>
      </xsl:template>
    </xsl:stylesheet>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points