Echelon i.LON SmartServer Technical Information Page 336

  • Download
  • Add to my manuals
  • Print
  • Page
    / 443
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 335
i.LON SmartServer 2.0 Programmer’s Reference
20-14
20.2.3
Instantiating the Web Service Client in Visual Basic .NET 3.5
The following example shows how to instantiate the Web service in Visual Basic. NET:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.ServiceModel 'make sure you add this statement to iLON_SoapCalls class
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.iLON100portTypeClient = Nothing
''' <summary>
''' Instantiate the SmartServer Web service for .NET 3.0 and 3.5 (NOT 2.0)
''' </summary>
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 i.LON SmartServer.
Dim endpointAddress As System.ServiceModel.EndpointAddress =
New System.ServiceModel.EndpointAddress("http://" + _iLonEndpointIpAddress + "/WSDL/iLON100.wsdl")
' Instantiate the SmartServer Web service object with this address and binding.
_iLON = New iLON_SmartServer.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
''' <summary>
''' Close the SmartServer Web service
''' </summary>
Public
Sub CloseBindingToSmartServer()
' Closing the client gracefully
' closes the connection and cleans up resources
Try
_iLON.Close()
Finally
_iLON = Nothing
End Try
End Sub
End Class
20.3
Calling Web Services Methods
The following examples demonstrate how to read and write values to a data point in Visual C# .NET
3.5, Visual C#.NET 2.0, and Visual Basic .NET 3.5, and how to setup a Web connection between a
SmartServer and a WebBinder Target Server.
Page view 335
1 2 ... 331 332 333 334 335 336 337 338 339 340 341 ... 442 443

Comments to this Manuals

No comments