using System; using System.IO; using ServiceStack.Service; using System.Net; namespace ServiceStack.ServiceClient.Web { #if SILVERLIGHT || MONOTOUCH || XBOX || ANDROID public class Soap12ServiceClient : IServiceClient { public Soap12ServiceClient(string uri) { throw new NotImplementedException(); } public void Dispose() { throw new NotImplementedException(); } public void SetCredentials(string userName, string password) { throw new NotImplementedException(); } public void GetAsync(string relativeOrAbsoluteUrl, Action onSuccess, Action onError) { throw new NotImplementedException(); } public void DeleteAsync(string relativeOrAbsoluteUrl, Action onSuccess, Action onError) { throw new NotImplementedException(); } public void PostAsync(string relativeOrAbsoluteUrl, object request, Action onSuccess, Action onError) { throw new NotImplementedException(); } public void PutAsync(string relativeOrAbsoluteUrl, object request, Action onSuccess, Action onError) { throw new NotImplementedException(); } public void SendAsync(object request, Action onSuccess, Action onError) { throw new NotImplementedException(); } public void SendOneWay(object request) { throw new NotImplementedException(); } public void SendOneWay(string relativeOrAbsoluteUrl, object request) { throw new NotImplementedException(); } public TResponse Send(object request) { throw new NotImplementedException(); } public TResponse PostFile(string relativeOrAbsoluteUrl, FileInfo fileToUpload, string mimeType) { throw new NotImplementedException(); } public TResponse PostFile(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, string mimeType) { throw new NotImplementedException(); } public TResponse PostFileWithRequest(string relativeOrAbsoluteUrl, FileInfo fileToUpload, object request) { throw new NotImplementedException(); } public TResponse PostFileWithRequest(string relativeOrAbsoluteUrl, Stream fileToUpload, string fileName, object request) { throw new NotImplementedException(); } } #else using System.ServiceModel; using System.ServiceModel.Channels; using ServiceStack.Text; using ServiceStack.Service; public class Soap12ServiceClient : WcfServiceClient { public Soap12ServiceClient(string uri) { this.Uri = uri.WithTrailingSlash() + "Soap12"; this.StoreCookies = true; } private WSHttpBinding binding; private Binding WsHttpBinding { get { if (this.binding == null) { this.binding = new WSHttpBinding { MaxReceivedMessageSize = int.MaxValue, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, MaxBufferPoolSize = 524288, }; this.binding.Security.Mode = SecurityMode.None; // CCB Custom // Yes, you need this to manage cookies yourself. Seems counterintutive, but set to true, // it only means that the framework will manage cookie propagation for the same call, which is // not what we want. if (StoreCookies) this.binding.AllowCookies = false; } return this.binding; } } protected override Binding Binding { get { return this.WsHttpBinding; } } protected override MessageVersion MessageVersion { get { return MessageVersion.Default; } } public override void SetProxy(Uri proxyAddress) { var wsHttpBinding = (WSHttpBinding)Binding; wsHttpBinding.ProxyAddress = proxyAddress; wsHttpBinding.UseDefaultWebProxy = false; wsHttpBinding.BypassProxyOnLocal = false; return; } } #endif }