Tech Off Post

Single Post Permalink

View Thread: Cant get webservice to work. Could not be loaded error
  • User profile image
    steinster

    Hi,

    I have this webservice;

    public class InfoSpreaderServices : System.Web.Services.WebService
        {
    
            [WebMethod]
            public void AddUser(int listRecno, string firstname, string lastname, string email) {
                if (!DataManager.EmailExists(listRecno, email)) {
                    DataManager.CreateNewRecipient(listRecno, firstname, lastname, email);
                }
                
            }
    
            [WebMethod]
            public void RemoveUser(int recipientRecno, string email) {
                DataRow r = DataManager.GetListRecipient(recipientRecno);
    
                if (r["Email"].ToString() == email) {
                    DataManager.DeleteRecipient(recipientRecno);
                }
            }
        }

     

    and I try to use the AddUser method like this;

    InfoSpreadServices.InfoSpreaderServicesSoapClient client = new InfoSpreadServices.InfoSpreaderServicesSoapClient();
    client.AddUser(int.Parse(TextBoxListRecno.Text), TextBoxFirstname.Text, TextBoxLastname.Text, TextBoxEmail.Text);

     

    But I always get this error;

    The operation 'AddUserAsync' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.

     

     

    any ideas on how to fix this ??