Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8795981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:30:53+00:00 2026-06-13T23:30:53+00:00

[WebService(Namespace = http://tempuri.org/)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // To allow this Web Service to

  • 0
   [WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{

    [WebMethod]
    public LoginResponse SignUp(string email, string password)
    {
        LoginResponse s = new LoginResponse();
        //s.Code = "123434";
        //s.Message = "Signup succeed";
        //s.UserId = "";
        return s;
    }

    [WebMethod]
    public SendCodeResponse SendCode(string userId, string barCode)
    {
        SendCodeResponse scr = new SendCodeResponse();
        scr.code = "";
        return scr;
    }



[Serializable]
    public class LoginResponse
    {
        string code;
        string message;
        string userId;

        [XmlElement(Type = typeof(string), ElementName = "Code")]
        public string Code
        {
            get { return code; }
            set { code = value; }
        }

        [XmlElement(Type = typeof(string), ElementName = "Message")]
        public string Message
        {
            get { return message; }
            set { message = value; }
        }

        [XmlElement(Type = typeof(string), ElementName = "UserId")]
        public string UserId
        {
            get { return userId; }
            set { userId = value; }
        }
    }


    [Serializable]
    public class SendCodeResponse
    {
        string code;
        [XmlElement(Type = typeof(string), ElementName = "Code")]
        public string Code
        {
            get { return code; }
            set { code = value; }
        }
    }

When I run this webservice it gives me

Server Error in ‘/’ Application.

The XML element ‘SendCodeResponse’ from namespace ‘http://tempuri.org/’ references a method and a type. Change the method’s message name using WebMethodAttribute or change the type’s root element using the XmlRootAttribute.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The XML element ‘SendCodeResponse’ from namespace ‘http://tempuri.org/’ references a method and a type. Change the method’s message name using WebMethodAttribute or change the type’s root element using the XmlRootAttribute.

Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:30:54+00:00Added an answer on June 13, 2026 at 11:30 pm

    Replace these 2 parts:

    Part 1:

    [Serializable]
    public class SendCodeResponse
    {
        string code;
        [XmlElement(Type = typeof(string), ElementName = "Code")]
        public string Code
        {
            get { return code; }
            set { code = value; }
        }
    }
    

    Part 2:

    [WebMethod]
    public SendCodeResponse SendCode(string userId, string barCode)
    {
        SendCodeResponse scr = new SendCodeResponse();
        scr.code = "";
        return scr;
    }
    

    With:

    New Part 1:

    [Serializable]
    public class SendCodeResult
    {
        string code;
        [XmlElement(Type = typeof(string), ElementName = "Code")]
        public string Code
        {
            get { return code; }
            set { code = value; }
        }
    }
    

    New Part 2:

    [WebMethod]
    public SendCodeResult SendCode(string userId, string barCode)
    {
        SendCodeResult scr = new SendCodeResult();
        scr.code = "";
        return scr;
    }
    

    As your WebMethod is called SendCode a type SendCodeResponse is automatically created, so you can’t make a class with that name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My webservice code [WebService(Namespace = http://tempuri.org/)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System.Web.Services.WebService
I have this web service : using System.Web.Services; namespace Contracts { [WebService(Namespace = http://tempuri.org/)]
I wrote the following service : namespace WebService1 { [WebService(Namespace = http://tempuri.org/)] [WebServiceBinding(ConformsTo =
I have the following web service that allows me uploading files: [WebService(Namespace = http://tempuri.org/)]
Im trying to get a page talking to a webservice through jquery. this is
This is c# .net 2.0. I am using a masterpage. The WebService works fine
I am currently using this page http://www.silverlightshow.net/items/Silvester-A-Silverlight-Twitter-Widget.aspx to make a Silverlight application that gets
I have written an ASMX service that looks like thus; namespace AtomicService { [WebService(Namespace
This is my webservice code which performs constructs xml file and stores to particular
I've setup this example web service to investigate the source of my error: namespace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.