Web service example 7: Define a component table to access a web service

Previous Next

This topic is 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:

1.In the Definer, delete the TRAVELCOMPONENT component used in previous examples.
2.In the Definer catalog, double-click Web Service Components.
The New Web Service Component Wizard appears.
3.In the WSDL File field, specify the http address of the WSDL file that you defined for the web service provider.
http://MyWebServer/TravelService/TRAVELSERVICE.wsdl
4.Click Next.
5.In the Web Service Methods list, select the GetMultipleTours method, and click Next.
6.Speciy Web Service Name: TRAVELCOMPONENT.
7.Fill in the Component Table fields as below:

 

8.Click Next, and click Finish.
The web service component is created.
9.Open the TRAVELCOMPONENT table.
10.In the TRAVELCOMPONENT component table, remove the DUMMY_COLUMN column, and add five new columns for the DESTINATION, TOUR_TYPE, NUM_DAYS, MAX_AGE, and DESCRIPTION columns of the TOUR table.
11.Open the TRAVELCOMPONENT web service component, and see that new parameters have been added for the QUERYEXE and QUERYFETCH methods.
12.On the Constructor tab page, change the Constructor SQL to:

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 that the Input XSL transformation has been replaced by NULL. In Web Service Example 8, you will see an example of an input XSL transformation.
13.Check the Constructor SQL.
14.Open the application, and execute a query in the External Tours info window.

NOTE: If you provide a query condition, first the complete record set is retrieved, and then the query is executed on the result set.