Web Service Example 7: Define a Component Table to Access a Web Service |
This topic is the second part of Web Service Example 7: Component Table with an Output XSL Transformation. To define a web service component and table that represents the GetMultipleTours method of the TRAVELSERVICE web service provider:
SELECT 'http://MyWebServer/TravelService/TRAVELSERVICE.wsdl', NULL, 0, NULL ,'<?xml version="1.0" encoding="Windows-1252"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns1="http://MyWebServer/TravelService/TRAVELSERVICE.wsdl"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:template match="/"> <Table> <xsl:for-each select="ns1:Tours/TOUR"> <Row> <xsl:element name="Field"> <xsl:attribute name="Name">DESTINATION</xsl:attribute> <xsl:attribute name="Value"> <xsl:value-of select="@DESTINATION"/></xsl:attribute> <xsl:attribute name="Index">1</xsl:attribute> </xsl:element> <xsl:element name="Field"> <xsl:attribute name="Name">TOUR_TYPE</xsl:attribute> <xsl:attribute name="Value"> <xsl:value-of select="@TOUR_TYPE"/></xsl:attribute> <xsl:attribute name="Index">2</xsl:attribute> </xsl:element> <xsl:element name="Field"> <xsl:attribute name="Name">NUM_DAYS</xsl:attribute> <xsl:attribute name="Value"> <xsl:value-of select="@NUM_DAYS"/></xsl:attribute> <xsl:attribute name="Index">3</xsl:attribute> </xsl:element> <xsl:element name="Field"> <xsl:attribute name="Name">MAX_AGE</xsl:attribute> <xsl:attribute name="Value"> <xsl:value-of select="@MAX_AGE"/></xsl:attribute> <xsl:attribute name="Index">4</xsl:attribute> </xsl:element> <xsl:element name="Field"> <xsl:attribute name="Name">DESCRIPTION</xsl:attribute> <xsl:attribute name="Value"> <xsl:value-of select="@DESCRIPTION"/></xsl:attribute> <xsl:attribute name="Index">5</xsl:attribute> </xsl:element> </Row> </xsl:for-each> </Table> </xsl:template> </xsl:stylesheet>'
NOTE: If you provide a query condition, first the complete record set is retrieved, and then the query is executed on the result set. |