SOAP tutorial
SOAP services Contact Details Extraction Service

## Example overview

This example demonstrates:

- Fetching HTML from a foreign host as specified by the user.

- Rendering the page with regexp_match() to extract the contacts information. For example, it take information from sequences like:

      "quoted text" said John Smith, Manager at A Company.

- Making a Web search with the company name to find the domain.
- Making an email address from contact name, and domain name.
- A SOAP call.
- Processing the 4 dimensional array in the AJAX based client.
- XSL transformation.

## Example Setup

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

- Define a SOAP type for 4 dimensional array.
- Define a stored procedure for the SOAP service that queries, web target and makes the contact info.
- The SOAP service is achieved by defining the /SOAP_SO_S_19 URL to have same functionality as using soap_server() function call.

## Example Operation

- Get a page from the URL.
- Substitute characters " as 0x94 etc.
- Remove <i>, <b>, <strong> elements.
- Take out CR/LF.
- Make breaks before <P and <H elements.
- Parse the page to have consistent escapes such as &quote; .
- If the above fails then achieve the same with substitutions.
- Have a function to return a regular expression(s) by given level of recursion.
- Have a recursive function which gets a regular expression based on depth and apply it against the text.
- If match found skip rest of pattern matching.
- If not, apply the next pattern.
- When contact matches name, title and company, the item will be added to a result array.
- Company of the result will be searched via Google to find 'home page' or 'welcome'.
- The top most result link from Google will be parsed to extract the name of the site ie. domain name part.
- The email will be composed as FirtsName.LastName@domain .
- A multidimensional array will be produced containing the name, company, title and email.
- Loop over the resulting array, and make an XML document.
- Render the XML to the HTML using XSL-T sheet.

## 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_19/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 len, i As Integer

            result = soap.ExContacts("http://www.openlinksw.com/press/oplappl4.htm")

            len = result.Length - 1
            For i = 0 To len Step 5
                System.Console.WriteLine("Name: " + result(i))
                System.Console.WriteLine("Title: " + result(i + 1))
                System.Console.WriteLine("Company: " + result(i + 2))
                System.Console.WriteLine("Email: " + result(i + 3))
                System.Console.WriteLine("Home page: " + result(i + 4))
                System.Console.WriteLine("")
            Next i
        End Sub