1.Create the proxy code through the SDK's svcutil command
2.Compile the code referencing the ServiceModel.dll
3.Use reflection to load the compiled dll referencing System.ServiceModel
4.Create the binding...In this case I used TCP
5.Setup an SecurityMode...In this case there is 'None'
6.Assign it to the binding
7.Create the new service call
8.Call method on the service
The following is powershell script to be used with .pst
csc /t:library BusConnect.cs /r:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\System.ServiceModel.dll"
$NetTcpBinding = new-object System.ServiceModel.NetTcpBinding
$endpoint = new-object System.ServiceModel.EndpointAddress("net.tcp://localhost:8085/DAX/BusConnect")
$secMode = new-object System.ServiceModel.SecurityMode
$NetTcpBinding.Security.Mode = $secMode;
$NudgeService = new-object BusConnectorClient($NetTcpBinding, $endpoint)
Now to make sure your script knows about SvcUtil and where to find System.ServiceModel, you want to find where they are located on the system and added to the Environment Variables, "Path". You can do this easily by left clicking on Computer and going to properties then Advanced System Settings and clicking on the Advanced tab.
Now that the paths are added to the Environment Variables, you need to setup PowerShell to run scripts.. Once setup, run the scripts by starting up powershell
Replied on Feb 14 2011 5:01AM