Example

Consider the following StockQuotesSoap SOAP request defined using the Swan and Mokashi WSDL:

<?xml version="1.0"?>
               
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
               
	<SOAP-ENV:Body>
               
		<s0:GetQuotes xmlns:s0="http://swanandmokashi.com">
               
			<s0:QuoteTicker>prgs</s0:QuoteTicker>
               
		</s0:GetQuotes>
               
	</SOAP-ENV:Body>
               
</SOAP-ENV:Envelope>
               

            

This SOAP request was created using the Stylus Studio Web Service Call Composer, as described in How to Compose a Web Service Call.

The XQuery generated by Stylus Studio for this Web service call looks like this:

declare namespace ws = "ddtekjava:com.stylusstudio.webservice.SOAPCall";
               
declare function ws:call($location as element(), $payload as element()) as 
document-node() external;
               
 
               
ws:call(
               
<location 
address="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" 
               
 soapaction="http://swanandmokashi.com/GetQuotes" />,
               
 
               
<s0:GetQuotes xmlns:s0="http://swanandmokashi.com">
               
	<s0:QuoteTicker>prgs</s0:QuoteTicker>
               
</s0:GetQuotes>
               
)
               

            

In addition to the header that declares the ws namespace and Java extension function, ws:call(), the generated code includes comments that specify .jar files that must be present in your Classpath in order to run the resulting XQuery in Stylus Studio. Here's an example of the complete code generated by Stylus Studio for a Swan & Mokashi Web service:

(: This function requires the following items in the classpath :)
               
(: axis-all.jar;xercesimpl.jar :)
               
(: xml-apis.jar only if running on Java 1.4 :)
               
 
               
(: Saxon function binding :)
               
(:declare namespace ws = "java:com.stylusstudio.webservice.SOAPCall";:)
               
 
               
(: DataDirect XQuery function binding :)
               
declare namespace ws = "ddtekjava:com.stylusstudio.webservice.SOAPCall";
               
declare function ws:call($location as element(), $payload as element()) as 
document-node() external;
               
 
               
ws:call(
               
<location 
address="http://www.swanandmokashi.com/HomePage/WebServices/StockQuotes.asmx" 
soapaction="http://swanandmokashi.com/GetQuotes" />,
               
 
               
<s0:GetQuotes xmlns:s0="http://swanandmokashi.com">
               
	<s0:QuoteTicker>prgs</s0:QuoteTicker>
               
</s0:GetQuotes>
               
)
               

            

 
Free Stylus Studio XML Training: