Hi all,
I am having an issue adding a web reference in VS 2010. I am working on a project in which XML Web Services has been mandated and am not able to use WCF. As a result, I created an XML Web Service in VS 2010 using 4.0 framework. I am trying to generate a proxy to the service from another solution using the Add Web Reference under the Advanced options for Add Service Reference. If I type in the URL of the service, the dialog finds it without a problem. Then, I give it the namespace AuthService and when I click to add the reference, the reference.cs file generated is almost completely empty. In addition, it is generating an invalid namespace. Below is what the reference.cs file contains.
#region Mappers //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.269 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace NJ.TREAS.TAX.CorpTaxRefunds.PTier.Proxies.Web References\AuthService { public partial class Automapper { public void Clear() { } } } #endregion
Furthermore, if I generate the proxy file from the command line using wsdl.exe, the proxy is generated as below.
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.269 // // 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=4.0.30319.1. // /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="AuthServiceSoap", Namespace="http://tempuri.org/")] public partial class AuthService : System.Web.Services.Protocols.SoapHttpClientProtocol { private System.Threading.SendOrPostCallback AuthenticateUserOperationCompleted; /// <remarks/> public AuthService() { this.Url = "http://localhost:54004/AuthService.asmx"; } /// <remarks/> public event AuthenticateUserCompletedEventHandler AuthenticateUserCompleted; /// <remarks/> [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AuthenticateUser", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public UserAccount AuthenticateUser(UserAccount existingAccount) { object[] results = this.Invoke("AuthenticateUser", new object[] { existingAccount}); return ((UserAccount)(results[0])); } /// <remarks/> public System.IAsyncResult BeginAuthenticateUser(UserAccount existingAccount, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("AuthenticateUser", new object[] { existingAccount}, callback, asyncState); } /// <remarks/> public UserAccount EndAuthenticateUser(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((UserAccount)(results[0])); } /// <remarks/> public void AuthenticateUserAsync(UserAccount existingAccount) { this.AuthenticateUserAsync(existingAccount, null); } /// <remarks/> public void AuthenticateUserAsync(UserAccount existingAccount, object userState) { if ((this.AuthenticateUserOperationCompleted == null)) { this.AuthenticateUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAuthenticateUserOperationCompleted); } this.InvokeAsync("AuthenticateUser", new object[] { existingAccount}, this.AuthenticateUserOperationCompleted, userState); } private void OnAuthenticateUserOperationCompleted(object arg) { if ((this.AuthenticateUserCompleted != null)) { System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); this.AuthenticateUserCompleted(this, new AuthenticateUserCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); } } /// <remarks/> public new void CancelAsync(object userState) { base.CancelAsync(userState); } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] public partial class UserAccount { private int idField; private string usernameField; private string firstNameField; private string lastNameField; private string emailField; private string telephoneField; private System.DateTime registrationDateField; private UserAccount registeredByField; private System.DateTime modifiedDateField; private UserAccount modifiedByField; private bool activeField; private UserRole roleField; /// <remarks/> public int Id { get { return this.idField; } set { this.idField = value; } } /// <remarks/> public string Username { get { return this.usernameField; } set { this.usernameField = value; } } /// <remarks/> public string FirstName { get { return this.firstNameField; } set { this.firstNameField = value; } } /// <remarks/> public string LastName { get { return this.lastNameField; } set { this.lastNameField = value; } } /// <remarks/> public string Email { get { return this.emailField; } set { this.emailField = value; } } /// <remarks/> public string Telephone { get { return this.telephoneField; } set { this.telephoneField = value; } } /// <remarks/> public System.DateTime RegistrationDate { get { return this.registrationDateField; } set { this.registrationDateField = value; } } /// <remarks/> public UserAccount RegisteredBy { get { return this.registeredByField; } set { this.registeredByField = value; } } /// <remarks/> public System.DateTime ModifiedDate { get { return this.modifiedDateField; } set { this.modifiedDateField = value; } } /// <remarks/> public UserAccount ModifiedBy { get { return this.modifiedByField; } set { this.modifiedByField = value; } } /// <remarks/> public bool Active { get { return this.activeField; } set { this.activeField = value; } } /// <remarks/> public UserRole Role { get { return this.roleField; } set { this.roleField = value; } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] public partial class UserRole { private int idField; private string nameField; private int sortOrderField; /// <remarks/> public int Id { get { return this.idField; } set { this.idField = value; } } /// <remarks/> public string Name { get { return this.nameField; } set { this.nameField = value; } } /// <remarks/> public int SortOrder { get { return this.sortOrderField; } set { this.sortOrderField = value; } } } /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] public delegate void AuthenticateUserCompletedEventHandler(object sender, AuthenticateUserCompletedEventArgs e); /// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class AuthenticateUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { private object[] results; internal AuthenticateUserCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState) { this.results = results; } /// <remarks/> public UserAccount Result { get { this.RaiseExceptionIfNecessary(); return ((UserAccount)(this.results[0])); } } }So, I guess I have multiple questions. Why isn't the Add Web Reference dialog generating the proxy correctly and how do I fix it? Also, what is the difference between using the Add Web Reference dialog and using wsdl.exe? I understand the dialog is a wrapper around wsdl.exe and that wsdl.exe provides more options but why is one working and not the other?
Thanks for any assistance that can be provided, I really appreciate it.