Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BasicHttpBinding binding = new BasicHttpBinding ();
- Uri baseAddress = new Uri ("URL.svc");
- EndpointAddress endpointAddress = new EndpointAddress (baseAddress);
- var myChannelFactory = new ChannelFactory<IMyInterface> (binding, endpointAddress);
- IMyInterface client = null;
- try
- {
- client = myChannelFactory.CreateChannel ();
- var a = client.WsFunction ("XXXXXX");
- ((ICommunicationObject)client).Close ();
- }
- catch
- {
- if (client != null)
- {
- ((ICommunicationObject)client).Abort ();
- }
- }
- [ServiceContract]
- public interface IMyInterface
- {
- [OperationContract]
- Result WsFunction1 (string param);
- [OperationContract]
- Result WsFunction2 (string param);
- [OperationContract]
- Result WsFunction3 (string param);
- }
- [DataContract]
- public class Result
- {
- string a = "";
- string b = "";
- [DataMember]
- public string A
- {
- get { return a; }
- set { a = value; }
- }
- [DataMember]
- public string B
- {
- get { return b; }
- set { b = value; }
- }
- }
- SLsvcUtil.exe /directory:C:usersmeDesktop http://URL.svc
- var binding = new BasicHttpBinding() {
- Name = "BindingName",
- MaxBufferSize = 2147483647,
- MaxReceivedMessageSize = 2147483647
- };
- var endpoint = new EndpointAddress("URL.svc");
- MyInterfaceClient client = new MyInterfaceClient(binding, endpoint);
- client.WSFunctionCompleted += (object sender, WSFunctionCompletedEventArgs e) => {
- //access e.Result here
- };
- client.WSFunctionAsync("XXXXXX");
- var binding = new BasicHttpBinding();
- binding.ProxyAddress = new Uri(string.Format("http://{0}:{1}", proxyAddress, proxyPort));
- binding.UseDefaultWebProxy = false;
- binding.Security.Mode = BasicHttpSecurityMode.Transport;
- binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
- binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Basic;
- var endpoint = new EndpointAddress("serviceadress");
- var authenticationClient = new WOKMWSAuthenticateClient(binding, endpoint);
- authenticationClient.ClientCredentials.UserName.UserName = username;
- authenticationClient.ClientCredentials.UserName.Password = password;
- ServicePointManager.Expect100Continue = false;
Add Comment
Please, Sign In to add comment