Created
March 30, 2014 19:26
-
-
Save DinisCruz/9878271 to your computer and use it in GitHub Desktop.
C# scripts used on blog post: 'Programmatically configuring an WCF service without using .config files (using FluentSharp REPL)'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return service1Client.GetData(42); | |
//O2Ref:WCF_Consumer.exe | |
//O2Ref:System.ServiceModel.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var composite = new CompositeType | |
{ | |
StringValue = "Hello ", | |
BoolValue = true | |
}; | |
return service1Client.GetDataUsingDataContract(composite); | |
//using WCF_Consumer.ServiceReference1 | |
//O2Ref:WCF_Consumer.exe | |
//O2Ref:System.ServiceModel.dll | |
//O2Ref:System.Runtime.Serialization.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myBinding = new WSHttpBinding(); | |
var url = "http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"; | |
var endpointAddress = new EndpointAddress(url); | |
var serviceClient = new Service1Client(myBinding,endpointAddress); | |
compositeType.StringValue = "Hello"; | |
return serviceClient.GetDataUsingDataContract(compositeType); | |
//using System.ServiceModel | |
//using WCF_Consumer.ServiceReference1 | |
//O2Ref:WCF_Consumer.exe | |
//O2Ref:System.ServiceModel.dll | |
//O2Ref:System.Runtime.Serialization.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Func<Service1Client> getServiceClient = | |
()=>{ | |
var url = "http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"; | |
var myBinding = new WSHttpBinding(); | |
var endpointAddress = new EndpointAddress(url); | |
return new Service1Client(myBinding,endpointAddress); | |
}; | |
Func<string, bool,CompositeType> sendAndReceive = | |
(stringValue, boolValue)=>{ | |
var serviceClient = getServiceClient(); | |
compositeType.StringValue = stringValue; | |
compositeType.BoolValue = boolValue; | |
return serviceClient.GetDataUsingDataContract(compositeType); | |
}; | |
return sendAndReceive("a Value ", true); | |
//using System.ServiceModel | |
//using WCF_Consumer.ServiceReference1 | |
//O2Ref:WCF_Consumer.exe | |
//O2Ref:System.ServiceModel.dll | |
//O2Ref:System.Runtime.Serialization.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var topPanel = "Example of WCF client call".popupWindow(250,100); | |
//var topPanel = panel.clear().add_Panel(); | |
var textBox = topPanel.add_TextBox(true); | |
var myBinding = new WSHttpBinding(); | |
var url = "http://localhost:8732/Design_Time_Addresses/WcfServiceLibrary1/Service1/"; | |
var endpointAddress = new EndpointAddress(url); | |
var serviceClient = new Service1Client(myBinding,endpointAddress); | |
var compositeType = new CompositeType { StringValue = "Hello from C# ", | |
BoolValue = true }; | |
var returnValue = serviceClient.GetDataUsingDataContract(compositeType); | |
textBox.set_Text(returnValue.StringValue); | |
return returnValue; | |
//using System.ServiceModel | |
//using WCF_Consumer.ServiceReference1 | |
//O2Ref:WCF_Consumer.exe | |
//O2Ref:System.ServiceModel.dll | |
//O2Ref:System.Runtime.Serialization | |
//O2File:c:\users\o2\documents\visual studio 2010\Projects\WCF_Consumer\Service References\ServiceReference1\Reference.cs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment