Click here to Skip to main content
15,892,059 members
Articles / Web Development / ASP.NET

Monitor your Web Services usage via .NET SOAP Extensions

Rate me:
Please Sign up or sign in to vote.
4.98/5 (48 votes)
6 Apr 2009CPOL27 min read 110.5K   3K   167  
This article demonstrates how you can monitor usage of your Web Services using .NET and SOAP Extensions.
//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.0.3705.288
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by Microsoft.VSDesigner, Version 1.0.3705.288.
// 
namespace WSDM_Client.localhost {
    using System.Diagnostics;
    using System.Xml.Serialization;
    using System;
    using System.Web.Services.Protocols;
    using System.ComponentModel;
    using System.Web.Services;
    
    
    /// <remarks/>
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="WSDM_WServiceSoap", Namespace="http://tempuri.org/")]
    public class WSDM_WService : System.Web.Services.Protocols.SoapHttpClientProtocol {
        
        public ClientMessageHeader ClientMessageHeaderValue;
        
        /// <remarks/>
        public WSDM_WService() {
            this.Url = "http://localhost/WSDM/WSDM_WService.asmx";
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapHeaderAttribute("ClientMessageHeaderValue", Required=false)]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetStockQuote", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public System.Double GetStockQuote(string companySymbol) {
            object[] results = this.Invoke("GetStockQuote", new object[] {
                        companySymbol});
            return ((System.Double)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetStockQuote(string companySymbol, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetStockQuote", new object[] {
                        companySymbol}, callback, asyncState);
        }
        
        /// <remarks/>
        public System.Double EndGetStockQuote(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((System.Double)(results[0]));
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapHeaderAttribute("ClientMessageHeaderValue", Required=false)]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetTemperatureByZipCode", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public System.Double GetTemperatureByZipCode(string zipCode) {
            object[] results = this.Invoke("GetTemperatureByZipCode", new object[] {
                        zipCode});
            return ((System.Double)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetTemperatureByZipCode(string zipCode, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetTemperatureByZipCode", new object[] {
                        zipCode}, callback, asyncState);
        }
        
        /// <remarks/>
        public System.Double EndGetTemperatureByZipCode(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((System.Double)(results[0]));
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapHeaderAttribute("ClientMessageHeaderValue", Required=false)]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetCurrencyExchangeRate", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public System.Double GetCurrencyExchangeRate(string currencyName) {
            object[] results = this.Invoke("GetCurrencyExchangeRate", new object[] {
                        currencyName});
            return ((System.Double)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetCurrencyExchangeRate(string currencyName, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetCurrencyExchangeRate", new object[] {
                        currencyName}, callback, asyncState);
        }
        
        /// <remarks/>
        public System.Double EndGetCurrencyExchangeRate(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((System.Double)(results[0]));
        }
    }
    
    /// <remarks/>
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
    [System.Xml.Serialization.XmlRootAttribute(Namespace="http://tempuri.org/", IsNullable=false)]
    public class ClientMessageHeader : SoapHeader {
        
        /// <remarks/>
        public string RegistrationKey;
    }
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Canada Canada
Kamran Bilgrami is a seasoned software developer with background in designing mission critical applications for carrier grade telecom networks. More recently he is involved in design & development of real-time biometric based security solutions. His areas of interest include .NET, software security, mathematical modeling and patterns.

He blogs regularly at http://WindowsDebugging.Wordpress.com

Comments and Discussions