I ran into some problem, but not sure if this is a problem, but I would like some advice.
I developed C # webservice in vs2010, and when I debug the service, I get this error in my browser
The XML element "VoucherResponse" from the namespace "http://test.org/" refers to the method and type. Change the name of the method message using WebMethodAttribute or change the root element of the type using XmlRootAttribute.
Description: An unhandled exception occurred during the execution of the current web request. View the stack trace for more information about the error and its occurrence in the code.
Exception Details: System.InvalidOperationException: The XML element 'VoucherResponse' from the namespace 'test.org' refers to the method and type. Change the name of the method message using WebMethodAttribute or change the root element of the type using XmlRootAttribute.
Source Error:
An unhandled exception was thrown during the execution of the current web request. Information about the origin and location of the exception can be identified using the exception stack trace below.
Now, looking at my code in the actual "VoucherResponse" class, I have
public class VoucherResponse : AResponse
{
public Voucher Voucher { get; set; }
}
And the Voucher object looks like this:
public class Voucher
{
public string PIN { get; set; }
public string Serial { get; set; }
public string Batch { get; set; }
}
Now in one of my web methods, I return VoucherResponse, and I assume that this error occurs when it is reflected and verified.
- , - ?