Using Web Service Calls as XML

In addition to opening a Web service call in the Web Service Call Composer for testing purposes, you can open a Web service call as an XML document anywhere in Stylus Studio - in the XML editor, or as a source document in the XQuery mapper for example. When you open a Web service call as an XML document, Stylus Studio automatically executes the SOAP request and displays the SOAP response.

Consider the following Web service call, stock.wsc. The Web service operation used in this example returns current stock quote and other information based on the ticker symbols provided as parameters. Here is the SOAP request composed by Stylus Studio:

<?xml version="1.0" standalone="no"?>
               
<SOAP-ENV:Envelope xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema" 
xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/">
               
	SOAP-ENV:Body>
               
		<s0:GetStockQuotes xmlns:s0="http://swanandmokashi.com/">
               
			<s0:QuoteTicker>prgs</s0:QuoteTicker>
               
		</s0:GetStockQuotes>
               
	</SOAP-ENV:Body>
               
</SOAP-ENV:Envelope>
               

            
	<soap:Body>
               
		<GetStockQuotesResponse xmlns="http://swanandmokashi.com/">
               
			<GetStockQuotesResult>
               
				<Quote>
               
					<CompanyName>PROGRESS SOFT</CompanyName>
               
					<StockTicker>PRGS</StockTicker>
               
					<StockQuote>20.10</StockQuote>
               
					<LastUpdated>10:17am</LastUpdated>
               
					<Change>+0.03</Change>
               
					<OpenPrice>20.05</OpenPrice>
               
					<DayHighPrice>20.40</DayHighPrice>
               
					<DayLowPrice>20.00</DayLowPrice>
               
					<Volume>13200</Volume>
               
					<MarketCap>695.1M</MarketCap>
               
					<YearRange>11.50 - 24.06</YearRange>
               
				</Quote>
               
			</GetStockQuotesResult>
               
		</GetStockQuotesResponse>
               
	</soap:Body>
               
</soap:Envelope>
               

            

And here is the SOAP response returned by the Web service:

<?xml version="1.0" encoding="utf-8"?>
               
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
               

            

The saved Web service call can be used as the source document for an XQuery in the XQuery mapper, as shown in Figure 371:

Figure 371. Using a Web Service Call to Compose an XQuery

XQueries composed using a Web service call as a source document return real-time data from the Web service as a result.

Business Solutions & Outsourcing

Business Solutions & Outsourcing companies know the best solutions. That's why they choose Stylus Studio to enhance their business productivity. See which companies are already using Stylus Studio 2006 to take care of their own business!

Government Agencies That Use Stylus Studio

Government agencies all around the nation are pledging their allegiance to Stylus Studio. Come see which government agencies are using the only XML IDE by the people and for the people.

Translating EDIFACT Documents to XML

The EDIFACT to XML Converter is a primary component of the adapter library. The XML that is generated is well commented and indented, and can be used anywhere XML is normally used — with XML Schemas, XQuery, XSLT, and so on.

Multi Channel Publishing

Multi channel publishing lets you go beyond single-source publishing of HTML and PDF to also generate simultaneously for non-document forms, such as to communicate with partners or drive spreadsheets.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member