Invoke Business Service Methods with the Siebel adapter using the WCF Service Model

You can create a WCF client that targets methods of Siebel business services. You can then use the WCF client to invoke these methods on the Siebel system. Siebel business services are surfaced under the Business Services node in the Add Adapter Service Reference Visual Studio Plug-in. The methods exposed by each business service are surfaced under the node corresponding to that service. You can follow the steps in Overview of the WCF Service Model with the Siebel Adapter to generate a WCF client for a business service and to use it to invoke the service's methods.

The following code uses a WCF client to invoke the Execute method of the TimeStamp business service. The time stamp, which is returned in the local time of the Siebel server, is then written to the console. The WCF client in this example is initialized from a configuration file generated by the Add Adapter Service Reference Plug-in. For an example of a generated configuration file, see Configure a WCF Client for a Siebel System.

using System;  
using System.Collections.Generic;  
using System.Text;  
  
using System.ServiceModel;  
using microsoft.lobservices.siebel._2007._03.BusinessServices.TimeStamp;  
  
namespace Business_Service  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            BusinessServices_TimeStamp_OperationClient client = null;  
  
            try  
            {  
                client =  
                     new BusinessServices_TimeStamp_OperationClient("SiebelBinding_BusinessServices_TimeStamp_Operation");  
  
                client.ClientCredentials.UserName.UserName = "YourUserName";  
                client.ClientCredentials.UserName.Password = "YourPassword";  
                client.Open();  
  
                ExecuteResponseRecord er = client.Execute();  
                Console.WriteLine(er.Time);  
  
                Console.WriteLine("\nHit <RETURN> to finish");  
                Console.ReadLine();  
            }  
            catch (Exception e)  
            {  
                Console.WriteLine(e.Message);  
            }  
            finally  
            {  
                // Close the client.  
                if (client != null)  
                {  
                    if (client.State == CommunicationState.Opened)  
                        client.Close();  
                    else  
                        client.Abort();  
                }  
            }  
        }  
    }  
}  

See Also

Develop Siebel Applications using the WCF Service Model