Creating a WCF Client for a Lotus Notes Domino Server Web Service

Creating a WCF Client for a Lotus Notes Domino Server Web Service

Lotus Notes is a popular messaging and collaboration tool sold by IBM. Lotus Notes Domino is a Web server designed to publish information from the Notes data stores. Domino currently provides the capability to expose BP 1.1 services for use in client applications and scenarios such as B2B. Although Lotus does have client development tools, Enterprises that utilize notes and the consumers of Domino-published content may want to develop clients using Visual Studio.NET. This is particularly desirable for many companies looking to take advantage of technologies such as the Windows Presentation Foundation (WPF) for a rich user experience, the Workflow Foundation (WF) for workflow, and the Windows Communication Foundation (WCF) for secure, reliable, transacted services.

Fortunately, it's very easy to do this using the same SvcUtil.exe utility that we used in the preceding exercise.

Microsoft has a licensed copy of Domino Server running the site that is populated with content by our colleague Gary Devendorf. Gary is a Technical Evangelist at Microsoft, and he helps customers interoperate between Lotus and Microsoft technologies, or migrate over from Lotus to Microsoft solutions.

On this site, Gary has created a Web service for placing orders over the web that are deposited in a Lotus Notes database. This Web service provides operations that allow you to place an order, change the status of an order, and check the status of an order.

In this exercise, you will create a console application that places an order and immediately checks the status of that order. It then calls the service to change the status to Approved and check the status once more. As part of testing the service, we'll go to a Domino web page to validate that the order has been received and has been approved.

Creating the WCF client for our WCF service will be virtually identical to how we created the WCF client for the ASMX and WCF services in the earlier example, using SvcUtil.exe. In this case, we're using the same approach to interoperate with a non-Microsoft Web server:

  1. Create a new Windows Console project in C:\WCFHandsOn\Chapter7\PartIII\Before\DominoClient\.

  2. Add a Reference to System.ServiceModel.

  3. Add using System.ServiceModel; to the top of the Program.cs file:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.ServiceModel;
  4. Open Visual Studio.NET Command Window.

  5. Execute the SvcUtil.exe utility with a reference to the service to create a proxy and configuration file to be used by the client.

    "c:\Program Files\Microsoft SDKs\Windows\v1.0\Bin\SvcUtil.exe "
  6. Using Solution Explorer, add proxy.cs to the DominoClient project.

  7. Using Solution Explorer, add output.config to the DominoClient project.

  8. Rename output.config to App.config.

  9. Open the App.config file.

    In the client section, add a name for our endpoint that we will use when calling the service by adding the text name="DominoOrders":

        <endpoint name="DominoOrders" address=
    create_order?OpenWebService bindingConfiguration="DominoSoapBinding"
     binding="customBinding" contract="Update" />

    You will now enter the core information for the client. Although there are sample values in the following code for the parameters (such as weight, shipAddress, shipCity), feel free to modify these.

  10. Place the following code in the Main method in the Program.cs file:

    static void Main(string[] args)
            using (UpdateProxy proxy = new UpdateProxy("DominoOrders"))
                   string customerID = "1";
                   string orderDate = "10/25/2006";
                   string weight = "50";
                   string freight = "100";
                   string shipAddress = "1 main street";
                   string shipCity = "Redmond";
                   string shipCountry = "USA";
                   string amount = "500.00";
                   //PLACE THE ORDER
                   int orderID = proxy.NEWORDER(customerID,orderDate,amount,freight, weight, 
    shipAddress, shipCity, shipCountry);
                   System.Console.WriteLine("Your order was placed. Your order ID for future 
    reference is " + orderID.ToString());
                   //CHECK THE STATUS OF THE ORDER
                   string status = proxy.CHECKSTATUS(orderID);
                   System.Console.WriteLine("Your order status is: " + status);
                   //APPROVE THE ORDER
                   System.Console.WriteLine("Cancelling order#" +
                   proxy.CHANGESTATUS(orderID, "Approved");
                   status = proxy.CHECKSTATUS(orderID);
                   System.Console.WriteLine("Your order status is: " + status);
  11. In Solution Explorer, right-click the project and select Debug, Start New Instance.

    The client will then print out several messages in the console window, identifying that the order has been placed, the order ID assigned by the server, and that the order has been approved. Make a note of the order ID, because we will now validate that this was accepted on the server.

    Go to the page on Domino to view the results.

  12. Open your web browser and navigate to

    You should see a web page with several links on it, as shown in Figure.

    1. Lotus Domino Web server page.

  13. Click on the Approved Orders link. This will display a list of all the orders that have been approved (see Figure).

    2. The Approved Orders page on the Lotus Domino Web server.

  14. To complete the exercise, validate that your order ID is included in the list of approved orders.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows