SOAP tutorial
SOAP & WSDL service Global provinces and administrative divisions lookup service

## Example overview

This example demonstrates:

- Fetching HTML from a foreign host to populate a native table.
- A SOAP call.
- SQL to XML conversion with FOR XML EXPLICIT.
- XSL transformation.

## Example Setup

The service is prepared by loading the SQL file. This performs the following:

- Fetch HTML country and province data from a foreign host.
- Insert the data into COUNTRY and PROVINCE tables.
- Fill tables COUNTRY_XML and PROVINCE_XML using http://[host:port]/DAV/factbook/factbook.xml. (http://www.xfront.org/factbook.xml)
- Define a stored procedure for the SOAP service that queries, using SQL, the data from the tables. The data is returned as XML, by including the FOR XML EXPLICIT clause, using the xml_auto() function to produce this as a string.
- Sample can use data from:
  1. Live feed from CIA factbook
  2. Cached XML Data
- The SOAP service is achieved by defining the /SOAP_SO_S_11 URL to have same functionality as using soap_server() function call.

## Example Operation

- Makes a SOAP client request. The XML result is held in a stream.
- Convert the stream using XSLT to HTML.
- Send the HTML to the browser for display.

## 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]/SOAP_SO_S_11/services.wsdl).
    3. Drag and drop the VirtuosoSOAP() from Class wizard in routine code.

        Sub Main()
            Dim soap As New WebReference1.VirtuosoSOAP()
            Dim result As String
            Dim sty As New Xml.Xsl.XslTransform()

            result = soap.administrative_divisions("United States", "")

            sty.Load("http://[host:port]/tutorial/services/so_s_11/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