The SOAPSearchSource is used to search Web Services. In this example we will search the
Google Web Service.
JSP components:
SearchForm Tag:
<search:SearchForm
formName="SOAPSearchForm"
categoryName="GoogleSOAP"
action="SOAPSearchSource.jsp"
/>
DisplayForm Tag:
<results:DisplayForm formName="HTMLSourceDisplay" pageSize="10" />
Demo configuration components:
XML Configuration for this example:
Search Form:
<SearchForm name="SOAPSearchForm" category="GoogleSOAP" >
<Field ID="KY" type="text" width="50" name="Keywords" />
</SearchForm>
Display Form:
Uses a TableDisplayFormRenderer
and an XSLResultRenderer. The GoogleSOAP Source
tag includes a <StringFilter> element to correct the ampersand-encoded highlight markup returned by
Google. Without this Filter, titles would be displayed as:
Document title with <b>keywords</b> highlighted
With the <StringFilter>, the titles will look like this:
Document title with keywords highlighted
<DisplayForm name="HTMLSourceDisplay"
rendererClass="com.raritantechnologies.quickstart.taglibrary.TableDisplayFormRenderer"
bgcolor1="#ffffff" bgcolor2="#EDF3FE" >
<ResultRenderer rendererClass="com.raritantechnologies.quickstart.taglibrary.XSLResultRenderer"
align="left" valign="top" defaultString=" " width="550">
<Source name="CBSNews" xslFile="BASE_PATH/WEB-INF/conf/CBSNews/CBSNewsDisplayTransform.xsl" />
<!-- Google puts some html markup that must be cleaned up in the HTML layer -->
<Source name="GoogleSOAP" xslFile="BASE_PATH/WEB-INF/conf/Google/GoogleDisplayTransform.xsl" >
<OutputFilter class="com.raritantechnologies.utils.filter.SequentialStringFilter" >
<StringFilter class="com.raritantechnologies.utils.filter.ReplaceSubstringFilter"
inPattern="<" outPattern="<" replace="ALL" />
<StringFilter class="com.raritantechnologies.utils.filter.ReplaceSubstringFilter"
inPattern=">" outPattern=">" replace="ALL" />
</OutputFilter>
</Source>
</ResultRenderer>
</DisplayForm>
Source configuration:
<!-- ======================================================================= -->
<!-- SOAPSearchSource: GoogleWebService -->
<!-- ======================================================================= -->
<SourceType name="GoogleSOAP" type="SOAPSearchSource" displayName="Federated SOAP - Google"
sourceFactoryClass="com.raritantechnologies.federated.SOAP.SOAPSearchSourceFactory"
queryProcessor="com.raritantechnologies.federated.SOAP.SOAPQueryProcessor" >
<SOAPServiceDef
targetObjectURI="http://api.google.com/search/beta2"
xslTransform="BASE_PATH/WEB-INF/conf/Google/GoogleSOAPResponse.xsl" />
<SOAPMethod methodName="ns1:doGoogleSearch"
namespace=""
SOAPAction="urn:GoogleSearchAction"
responseXMLType="GoogleSearchResult"
namespaceHost="urn:GoogleSearch" >
<parameter name="key" type="xsd:string" value="ezC+bv9QFHIjUVV1qy69oMCJwjnDcuCW" />
<parameter name="q" type="xsd:string" field="KY" />
<parameter name="start" type="xsd:int" value="0" computeFrom="(START_REC-1)" />
<parameter name="maxResults" type="xsd:int" value="10" />
<parameter name="filter" type="xsd:boolean" value="true" />
<parameter name="restrict" type="xsd:string" value="" />
<parameter name="safeSearch" type="xsd:boolean" value="false" />
<parameter name="lr" type="xsd:string" value="" />
<parameter name="ie" type="xsd:string" value="latin1" />
<parameter name="oe" type="xsd:string" value="latin1" />
<ResponseProcess>
<ResponseParameter path="/descendant::estimatedTotalResultsCount"
outputTo="TOTAL_DOCS" />
</ResponseProcess>
</SOAPMethod>
</SourceType>