Getting Started with Visual Studio

You can use Microsoft Visual Studio to implement a client application that uses the Luminate Online Web Services. This topic outlines the process for Visual C#.

  1. Open any edition of Microsoft Visual C# 2008. Note that you can implement the client using the Express Edition, which is available as a free download from Microsoft.
  2. Choose File -> New Project from the application menu.
  3. Choose the Console Application template in the New Project dialog and click OK to create the project:

  4. Choose Project-> Add Service Reference from the application menu:

  5. Enter the URL of your Luminate Online WSDL in the Address field and click the Go button.
  6. Enter "Convio" in the Namespace field:

  7. Click OK to generate the classes representing the web service operations and data objects. The Convio service reference should appear in the Solution Explorer pane. To view the WSDL and check for problems, first click on the Show All Files button in the Solution Explorer toolbar:

  8. Then right-click on wsdl.wsdl and choose Open. Any errors or warnings associated with the WSDL will appear in the Error List pane. You may have to toggle display of the messages by clicking the buttons in the Error List toolbar:

    Note that warnings can be safely ignored.
  9. Edit Program.cs and enter the following test program:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Convio.SoapClient client = new Convio.SoapClient();
    
                System.Console.WriteLine("Connecting to " + client.Endpoint.Address);
    
                Convio.LoginResult result = client.Login("myapiuser", "myapipassword");
    
                System.Console.WriteLine("Login successful");
            }
        }
    }
            
    The finished program should look like this:

  10. Press F5 to run the test program.

Specifying the Endpoint URL at Runtime

Site-specific applications can simply use the static endpoint URL specified by the WSDL. Generic applications that can access multiple sites have to specify the endpoint URL at runtime. This can be done simply by overriding the Endpoint.Address property:

using System.ServiceModel;
...
Convio.SoapClient client = new Convio.SoapClient();
client.Endpoint.Address = new EndpointAddress("http://webservices.cluster2.convio.net/1.0/mysite");

Setting optional, nullable attributes

The Luminate Online WSDL defines all fields as both nullable and optional (minOccurs="0"). This makes it easier to send and receive partial records, including only relevant fields, rather than requiring both the client and server to specify full records for every operation.

To distinguish between null elements that should be specified as nil and elements that should simply be omitted, the standard XML serializer generated by the .NET framework adds a special flag to each non-String attribute. This flag must be set to true for the attribute to be serialized as part of a SOAP message:

Convio.Constituent constituent = new Convio.Constituent();
constituent.ExternalYtdGiftAmountSpecified = true; // this flag must be set to serialize this attribute in the SOAP message.
constituent.ExternalYtdGiftAmount = 500.00;
      

Comments

Submitted by alan at 03:10 AM on March 15, 2014
Very good article thank you...

Leave a Comment

Nickname
Comment
Enter this word: