Webservice Macro Example - Bing Search #2
This example demonstrates the usage of the se:webservice macro. It will call the Bing Search webservice with a fixed search term and uses the se:xmlprocessor macro to transform the result into a html lay-out.
(This example is similar to the Webservice Macro Example - Bing Search, except for the way the response from the webservice is transformed into html.)
Note: to use the Bing webservice you would need a developer key (AppId).
Smartsite SXML | Copy Code |
---|---|
<se:webservice save="result" resulttype="xml"> <se:parameters> <se:parameter name="url">http://api.bing.net/soap.asmx</se:parameter> <se:parameter name="soapaction">http://schemas.microsoft.com/LiveSearch/2008/03/Search/Search</se:parameter> <se:parameter name="literalmethodnode"> <SearchRequest xmlns="http://schemas.microsoft.com/LiveSearch/2008/03/Search"> <parameters> <Query>Smartsite iXperion</Query> <AppId>-- your app id --</AppId> <Sources><SourceType>Web</SourceType></Sources> <Web><Count>10</Count></Web> </parameters> </SearchRequest> </se:parameter> </se:parameters> </se:webservice> <se:xmlprocessor xml="{buffer.get(result)}" buildstring="true"> <se:parameters> <se:parameter name="namespaces"> <se:collection> <se:member prefix="b">http://schemas.microsoft.com/LiveSearch/2008/03/Search</se:member> </se:collection> </se:parameter> <se:parameter name="actions"> <se:collection> <se:member query="//b:WebResult" type="multiplenodes"> <p> <a href="{this.getvalue('b:DisplayUrl')}">{this.getvalue("b:Title")}</a> <br /> {this.getvalue("b:Description")} <br /> <span style="color:green">{this.getvalue('b:DisplayUrl')}</span> </p> </se:member> </se:collection> </se:parameter> </se:parameters> </se:xmlprocessor> |
Example Result | Copy Code |
---|---|
<!-- html containing bing search result --> |