Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Channels
Imports System.Runtime.Serialization
Namespace Test1.Exchange.Clients
<ServiceContract()> _
Public Interface iMath
'' TODO: Add your service operations here
<OperationContract()> _
Function penambahan(ByVal nilai1 As Integer, ByVal nilai2 As Integer) As Integer
<OperationContract()> _
Function pengurangan(ByVal nilai1 As Integer, ByVal nilai2 As Integer) As Integer
<OperationContract()> _
Function perkalian(ByVal nilai1 As Integer, ByVal nilai2 As Integer) As Integer
<OperationContract()> _
Function pembagian(ByVal nilai1 As Integer, ByVal nilai2 As Integer) As Integer
End Interface
Module Module1
Sub Main()
' proses memulai ABC of Services sampai proxy object'
Dim address As EndpointAddress = New EndpointAddress("http://localhost:8888/Test1/Exchange") Dim binding As BasicHttpBinding = New BasicHttpBinding()
Dim channelFactory As IChannelFactory(Of iMath) = _
New ChannelFactory(Of iMath)(binding)
Dim proxy As iMath = channelFactory.CreateChannel(address)
'proses akses service class-nya Math
Dim hasilPenambahan As Integer
hasilPenambahan = proxy.penambahan(3, 4)
Console.WriteLine("Hasil Penambahan 3 + 4 = {0}", hasilPenambahan)
Dim hasilPengurangan As Integer
hasilPengurangan = proxy.pengurangan(6, 2)
Console.WriteLine("Hasil Pengurangan 6 + 2 = {0}", hasilPengurangan)
Dim hasilPerkalian As Integer
hasilPerkalian = proxy.perkalian(5, 2)
Console.WriteLine("Hasil Perkalian 5 x 2 = {0}", hasilPerkalian)
Dim hasilPembagian As Integer
hasilPembagian = proxy.pembagian(10, 2)
Console.WriteLine("Hasil Pembagian 10 : 2 = {0}", hasilPembagian)
Console.ReadLine()
End Sub
End Module
End Namespace