Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

XML Serialization and Firewalls

, 7 Jul 2007
A sample on transmitting binary content over firewalls
serial_downloader_-_codeproject.zip
Serial Downloader - CodeProject
SDWebService
App_Code
Properties
SDWinClient
bin
Debug
SDWinClient.exe
SDWinClient.pdb
SDWinClient.vshost.exe
obj
Debug
SalvatoreCarlos.CodeProject.SerialDownloader.SDWinClient.Form1.resources
SDWinClient.csproj.GenerateResource.Cache
SDWinClient.exe
SDWinClient.pdb
SiProd.Applications.SerialDownloader.SDWinClient.Properties.Resources.resources
TempPE
Properties.Resources.Designer.cs.dll
Web References.localhost.Reference.cs.dll
Properties
Settings.settings
SDWinClient.csproj.user
Web References
localhost
Reference.map
SerialDownloader.disco
SerialDownloader.wsdl
Serial Downloader - CodeProject.suo
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.42.
// 
#pragma warning disable 1591

namespace SiProd.Applications.SerialDownloader.SDWinClient.localhost {
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="SDWebServiceSoap", Namespace="http://tempuri.org/")]
    public partial class SDWebService : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        private System.Threading.SendOrPostCallback GetBase64StringFromResourceOperationCompleted;
        
        private bool useDefaultCredentialsSetExplicitly;
        
        /// <remarks/>
        public SDWebService() {
            this.Url = global::SiProd.Applications.SerialDownloader.SDWinClient.Properties.Settings.Default.SDWinClient_localhost_SDWebService;
            if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
                this.UseDefaultCredentials = true;
                this.useDefaultCredentialsSetExplicitly = false;
            }
            else {
                this.useDefaultCredentialsSetExplicitly = true;
            }
        }
        
        public new string Url {
            get {
                return base.Url;
            }
            set {
                if ((((this.IsLocalFileSystemWebService(base.Url) == true) 
                            && (this.useDefaultCredentialsSetExplicitly == false)) 
                            && (this.IsLocalFileSystemWebService(value) == false))) {
                    base.UseDefaultCredentials = false;
                }
                base.Url = value;
            }
        }
        
        public new bool UseDefaultCredentials {
            get {
                return base.UseDefaultCredentials;
            }
            set {
                base.UseDefaultCredentials = value;
                this.useDefaultCredentialsSetExplicitly = true;
            }
        }
        
        /// <remarks/>
        public event GetBase64StringFromResourceCompletedEventHandler GetBase64StringFromResourceCompleted;
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetBase64StringFromResource", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public string GetBase64StringFromResource(string URI) {
            object[] results = this.Invoke("GetBase64StringFromResource", new object[] {
                        URI});
            return ((string)(results[0]));
        }
        
        /// <remarks/>
        public void GetBase64StringFromResourceAsync(string URI) {
            this.GetBase64StringFromResourceAsync(URI, null);
        }
        
        /// <remarks/>
        public void GetBase64StringFromResourceAsync(string URI, object userState) {
            if ((this.GetBase64StringFromResourceOperationCompleted == null)) {
                this.GetBase64StringFromResourceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetBase64StringFromResourceOperationCompleted);
            }
            this.InvokeAsync("GetBase64StringFromResource", new object[] {
                        URI}, this.GetBase64StringFromResourceOperationCompleted, userState);
        }
        
        private void OnGetBase64StringFromResourceOperationCompleted(object arg) {
            if ((this.GetBase64StringFromResourceCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetBase64StringFromResourceCompleted(this, new GetBase64StringFromResourceCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        public new void CancelAsync(object userState) {
            base.CancelAsync(userState);
        }
        
        private bool IsLocalFileSystemWebService(string url) {
            if (((url == null) 
                        || (url == string.Empty))) {
                return false;
            }
            System.Uri wsUri = new System.Uri(url);
            if (((wsUri.Port >= 1024) 
                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
                return true;
            }
            return false;
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    public delegate void GetBase64StringFromResourceCompletedEventHandler(object sender, GetBase64StringFromResourceCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetBase64StringFromResourceCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetBase64StringFromResourceCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public string Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((string)(this.results[0]));
            }
        }
    }
}

#pragma warning restore 1591

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

carlosmsr
Architect
Argentina Argentina
No Biography provided

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 7 Jul 2007
Article Copyright 2007 by carlosmsr
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid