16.10.2015 Views

Getting Started with IBM Data Studio for DB2

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix E – Advanced topics <strong>for</strong> developing data web services 379<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Listing E.6 – Schema <strong>with</strong> verbose result set in<strong>for</strong>mation<br />

E.4 Trans<strong>for</strong>m input and output messages using XSL<br />

You can assign an Extensible Stylesheet Language Trans<strong>for</strong>mation (XSLT) to one or more<br />

of your operations to change the default XML input and output message <strong>for</strong>mat. This<br />

feature allows you to customize the <strong>for</strong>mat of the messages that the client sees; <strong>for</strong><br />

example, to support industry standards or to changing or hiding default tag names in the<br />

request and response messages. You can even generate non-XML outputs – like HTML<br />

pages.<br />

To give you some hands-on experience about stylesheets and what they can do <strong>for</strong> you,<br />

we show you an easy way to trans<strong>for</strong>m your web service response into a service message<br />

that is written in HTML <strong>for</strong>mat. All web browsers can interpret HTML code. As a result, you<br />

can start your web service directly through a web browser and receive a <strong>for</strong>matted<br />

response.<br />

We use theGetBestSellingProductsByMonth operation and change its output into<br />

HTML. You can simply use the HTTP GET binding to start the operation from a web<br />

browser and verify the HTML response.<br />

E.4.1 Creating an XSL stylesheet<br />

<strong>Data</strong> <strong>Studio</strong> provides an XSL editor as well as the ability to test your XSL script. To create<br />

a new XSL file:<br />

1. Select File -> New -> Other -> XML.<br />

2. Select your data development project as the parent folder and use the name<br />

GetBestSellingProductsByMonthToHTML.xsl.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!