beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 404

background image

i.LON SmartServer 2.0 Programmer’s Reference

21-52

vbNewLine)

Thread.Sleep(10000)

Dim

newTime

As

New

iLON_SmartServer_System.messageProperties_system()


Dim

newTimeData

As

String

=

"SI_TIME"

Dim

newTimeResult

As

String

=

SmartServer._iLON.SystemService_Read_Info(newTime, newTimeData)


Console.Out.WriteLine(newTimeResult)

Console.ReadLine()

Finally

SmartServer.CloseBindingToSmartServer()

End Try

End

Sub


End

Module

Web Service Instantiation in iLON_SoapCalls Class

Imports

System

Imports

System.Collections.Generic

Imports

System.Linq

Imports

System.Text

Imports

System.ServiceModel

Public

Class

iLON_SoapCalls

'your SmartServer’s IpAddress

Public

_iLonEndpointIpAddress

As

String

=

"<SmartServer IP address>"

'your SmartServer’s Web service reference

Public

_iLON

As

iLON_SmartServer_System.iLON100portTypeClient =

Nothing

'''

''' Instantiates the i.LON web service for

''' .NET 3.5

'''

Public

Sub

BindClientToSmartServer()

' Specify the binding to be used for the client.

Dim

binding

As

BasicHttpBinding =

New

BasicHttpBinding()


' Initialize the namespace

binding.Namespace =

"http:'wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/"

' Obtain the URL of the Web service on the SmartServer.

Dim

endpointAddress

As

System.ServiceModel.EndpointAddress =

New

System.ServiceModel.EndpointAddress(

"http://"

+ _iLonEndpointIpAddress +

"/WSDL/iLON100_System.wsdl"

)


' Instantiate the SmartServer Web service object with this address and binding.

_iLON =

New

iLON_SmartServer_System.iLON100portTypeClient(binding, endpointAddress)


' uncomment the lines below to enable authentication

' binding.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.TransportCredentialOnly

' binding.Security.Transport.ClientCredentialType =

' System.ServiceModel.HttpClientCredentialType.Basic

' _iLON.ChannelFactory.Credentials.UserName.UserName = "ilon"

' _iLON.ChannelFactory.Credentials.UserName.Password = "ilon"

End

Sub

'''

''' Close the i.LON web service

'''

Public

Sub

CloseBindingToSmartServer()