Example: Querying a Web Service

In this example, we'll use the ddtek:wscall function to query the Swanand Mokashi StockQuotes Web service.

To query the Swanand Mokashi Web Service:
2. For our source document, we'll use a simple XML document that contains only a ticker value - PRGS.

For the target, we'll create a root node (right-click the Set Target Document pane and choose Create Root Element), and a child element, my_quote.

When we're done, our Mapper canvas looks like this:

a. Right-click the source document URL, and choose Associate with > Global
b. In the Associate Schema with Variable dialog box, we enter ticker_source and click OK.

Now the document URL appears as $ticker_source, allowing us to easily substitute other source documents for use with this XQuery.

Stylus Studio specified location, payload, and output ports based on the Web service we used to create the wscall function block. (Double-click the ports to display this information.) However, not all of the values required to generate the output we need - the specific company stock ticker we want to look up, and what information about that stock we want Swanand Mokashi to provide - has been specified. We'll do that now.

4. Double-click the payload port, and map the ticker node from the source document to the tns:QuoteTicker node in the payload port information box.

The Web service will be given the value of the ticker element from our source document when the XQuery is run.

5. Close the payload information box.

Next, let's specify the information we want from the Swanad Mokashi Web service.

6. Since we'll want multiple pieces of information from the Web service (we want to see the company name, ticker value, and current stock price in our output), we define a FLWOR block so that we make one call to the Web service.

Right-click the Mapper canvas and choose FLWOR Block.

Stylus Studio adds a FLWOR block to the XQuery Mapper.

7. Double-click the output port and fully expand the output port information box.

9. Next, map the FLWOR block's output port to the my_quote node we created in the target document.

a. Using the right mouse button (mouse button 2), drag the node to the my_quote node in the target document.
b. When we release the mouse button to drop the Web service node, we choose Add Child Element and Map It.
c. We rename the target node, dropping the tns: prefix, in the Name dialog box when the target document element is created.
d. When finished, close the output port information box.

When we're done with this step, our output mappings look like this:

Sample XQuery Code

Here's the XQuery code that Stylus Studio created for us, based on the XQuery mapping:

And when we preview the code, this is our result:

XML Differencing

Stylus Studio's integrated XML Differencing tool visually computes and analyzes any changes made to files or folders in a highly configurable, XML-aware fashion. Display text or tree views, with changes displayed in a merged view or side-by-side!

Scientific, Photo & Control Equipment

Scientific, photo & control equipment companies hear clicks and beeps all day. But, when it comes to data integration it needs to be done in a flash, that's why they use Stylus Studio. Come see which top companies are seeing XML in a brand new light!

Introduction to Convert to XML

Convert to XML is Stylus Studio's all-purpose utility for getting legacy data integration of all sorts into a custom XML format. This video provides an overview of the tool and walks you through a sample CSV to XML data transformation project.

Consumer Food Products

Want to know what special ingredient is in these consumer food product companies work enviornment? Well it's a touch Stylus Studio that give these consumer food product companies the extra edge they need for producing such high quality food products!

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member