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

WebService Authentication with UsernameToken in WSE 3.0

, 12 Jul 2007
Passing a username and password as plain text
usernametokenwse30.zip
UsernameAssertionLibrary
bin
Debug
UsernameAssertionLibrary.dll
UsernameAssertionLibrary.pdb
Properties
WebService
App_Code
App_Data
Bin
UsernameAssertionLibrary.dll
UsernameAssertionLibrary.pdb
TestWebService
Properties
Settings.settings
Web References
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

// 
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
// 


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://tempuri.org/")]
public partial class Service : Microsoft.Web.Services3.WebServicesClientProtocol {
    
    private System.Threading.SendOrPostCallback HelloMyFriendOperationCompleted;
    
    /// <remarks/>
    public Service() {
        this.Url = "http://localhost:1515/WebService/Service.asmx";
    }
    
    /// <remarks/>
    public event HelloMyFriendCompletedEventHandler HelloMyFriendCompleted;
    
    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/HelloMyFriend", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
    public string HelloMyFriend() {
        object[] results = this.Invoke("HelloMyFriend", new object[0]);
        return ((string)(results[0]));
    }
    
    /// <remarks/>
    public System.IAsyncResult BeginHelloMyFriend(System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("HelloMyFriend", new object[0], callback, asyncState);
    }
    
    /// <remarks/>
    public string EndHelloMyFriend(System.IAsyncResult asyncResult) {
        object[] results = this.EndInvoke(asyncResult);
        return ((string)(results[0]));
    }
    
    /// <remarks/>
    public void HelloMyFriendAsync() {
        this.HelloMyFriendAsync(null);
    }
    
    /// <remarks/>
    public void HelloMyFriendAsync(object userState) {
        if ((this.HelloMyFriendOperationCompleted == null)) {
            this.HelloMyFriendOperationCompleted = new System.Threading.SendOrPostCallback(this.OnHelloMyFriendOperationCompleted);
        }
        this.InvokeAsync("HelloMyFriend", new object[0], this.HelloMyFriendOperationCompleted, userState);
    }
    
    private void OnHelloMyFriendOperationCompleted(object arg) {
        if ((this.HelloMyFriendCompleted != null)) {
            System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
            this.HelloMyFriendCompleted(this, new HelloMyFriendCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
        }
    }
    
    /// <remarks/>
    public new void CancelAsync(object userState) {
        base.CancelAsync(userState);
    }
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
public delegate void HelloMyFriendCompletedEventHandler(object sender, HelloMyFriendCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class HelloMyFriendCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
    
    private object[] results;
    
    internal HelloMyFriendCompletedEventArgs(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]));
        }
    }
}

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

DAT HAN

United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 12 Jul 2007
Article Copyright 2007 by DAT HAN
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid