SOAP
SO-S-7 SOAP & WSDL service
Stock Quotes service
SOAP Server setup
- An executable virtual directory is needed to create a SOAP based service.
- The service in practice is a PL procedure or group of PL procedures. In this example the PL module contains a single procedure. The procedure makes a request to the quotes.nasdaq.com. The retrieved XML document is returned as a string.
- VSP page for WSDL generation: For this example it is so_s_7_wsdl.vsp. A WSDL response is made and sent to the client.
- VSP for SOAP server: The SOAP server can be invoked using a soap_server() call. The so_s_7_server.vsp page shows setup of the SOAP server using the soap_server().
Example Virtuoso client invoked from VSP
- Virtuoso client is invoked from the VSP page so_s_7_client.vsp.
- This page accepts an issuer code and processes it with the Virtuoso SOAP client function - soap_call().
- The soap method in this request is the name of the procedure defined in Step 2 above.
- The result from the SOAP request will be transformed with an XSL-T style-sheet, and sent to the browser as an HTML document.
Example AJAX SOAP client invoked from JavaScript
- The "nasdaq_ajax.html" (listed below) contains a JavaScript code used to invoke SOAP client.
- This client will invoke the Virtuoso SOAP service as defined above.
- The JavaScript code uses XMLHttpRequest object.
Invoking the operation via VB.NET application
The following example demonstrates the usage of the Microsoft .NET against Virtuoso's SOAP service as defined in 'Server Setup':
1. Open a new VB.NET project for Console Application.
2. Add a web reference to the Virtuoso WSDL end point (http://[host:port]/xml-soap/services.wsdl).
3. Drag and drop the VirtuosoSOAP() from Class wizard in routine code.
Sub Main()
Dim soap As New WebReference1.VirtuosoDB_DBA_NasdaqQuotes()
Dim result As String
Dim sty As New Xml.Xsl.XslTransform()
result = soap.get_NasdaqQuotes("YHOO")
sty.Load("http://[host:port]/tutorial/services/so_s_7/sr.xsl")
Dim strReader As New IO.StringReader(result)
Dim xpDoc As New Xml.XPath.XPathDocument(strReader)
Dim arg As New Xml.Xsl.XsltArgumentList()
Dim strWriter As New IO.StringWriter()
sty.Transform(xpDoc.CreateNavigator(), arg, strWriter)
System.Console.WriteLine(strWriter.ToString)
End Sub
| View the source | Action |
|---|---|
| 1. so_s_7.sql | Set the initial state |
| 2. nasdaq_ajax.html | Run |
| 3. so_s_7_client.vsp | Run |
| 4. so_s_7_server.vsp | |
| 5. so_s_7_wsdl.vsp | |
| 6. sr.xsl |
OpenLink Home
Technical Support