beautypg.com

7 configuring the smartserver in visual c# .net, Configuring the smartserver in visual c# .net -26 – Echelon i.LON SmartServer 2.0 User Manual

Page 378

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-26

finally

{

iLON_SoapCalls

.CloseBindingToSmartServer();

}
}
}
}

21.1.7

Configuring the SmartServer in Visual C# .NET

This console example uses the system information methods in the SmartServer’s system WSDL
(iLON100_System.wsdl) to check the SmartServer's current time and system information and then
sets a new time. Note that the iLON_SoapCalls class references the iLON100_System Web service
instead of the iLON100 Web service. The instantiation of the iLON100_System Web service for the
NET 3.5 and NET 2.0 Frameworks are presented after this example.

For more information on the system information properties set in this example, see section 19.1,
System Service Methods.

You can execute this code after you have referenced and inherited from the SmartServer WSDL as
described in section 20.1.

Main Program

using

System;

using

System.Collections.Generic;

using

System.Linq;

using

System.Text;

using

System.Threading;

namespace

SystemServiceExample

{

class

System_Time

{

// If you are using NET 2.0 Framework, uncomment the following line of code to enter your

// SmartServer’s IP Address

// public static string _iLonEndpointIpAddress = "<SmartServer IP Address>";

static

void

Main(

string

[] args)

{

iLON_SoapCalls

.BindClientToSmartServer();


// If you are using NET 2.0 Framework, comment out the previous line of code, and then
// uncomment the following line of code

// iLON_SoapCalls.BindClientToSmartServer(_iLonEndpointIpAddress);

iLON_SmartServer.

iLON100portTypeClient

SmartServer =

iLON_SoapCalls

._iLON;


// See Section 20.2.1 (NET 3.5) or 20.2.2 (NET 2.0)for more information on iLON_SoapCalls class

try

{


//------------Checking System Time-------------------------------------------

//This code checks the SmartServer's time and system info and then sets a new time

Console

.Out.WriteLine(

"Checking the SmartServer's System Time\r\n"

);


iLON_SmartServer_System.

messageProperties_system

time =

new

iLON_SmartServer_System.

messageProperties_system

();

string

timeData =

"SI_TIME"

;

string

timeResult = SmartServer.SystemService_Read_Info(

ref

time, timeData);

Console

.Out.WriteLine(timeResult);


Console

.Out.WriteLine(

"\r\nChecking the SmartServer's System Information\r\n"

);