Web Service XML Tag Rename
-
Hi all, I am developing a couple of web services for work. Most of the methods return custom classes but I want one of them to just return a 'string' (either "OK" or "NOTOK"). The problem is that, whilst with custom classes the webservice's XML's tags are named according to the variable name (for example: 5 ... where HotelSummary is a type but HotelID is the variable name), with strings the XML returned is OK. Is it possible to rename the tags to display, for example, OK instead of the datatype? Thanks a lot.
In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)
-
Hi all, I am developing a couple of web services for work. Most of the methods return custom classes but I want one of them to just return a 'string' (either "OK" or "NOTOK"). The problem is that, whilst with custom classes the webservice's XML's tags are named according to the variable name (for example: 5 ... where HotelSummary is a type but HotelID is the variable name), with strings the XML returned is OK. Is it possible to rename the tags to display, for example, OK instead of the datatype? Thanks a lot.
In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)
il_manti wrote:
but I want one of them to just return a 'string' (either "OK" or "NOTOK").
Why not use
bool
then? ReturnTrue/false
il_manti wrote:
Is it possible to rename the tags to display, for example, OK instead of the datatype?
I don't think you can rename it. I am not sure though.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Hi all, I am developing a couple of web services for work. Most of the methods return custom classes but I want one of them to just return a 'string' (either "OK" or "NOTOK"). The problem is that, whilst with custom classes the webservice's XML's tags are named according to the variable name (for example: 5 ... where HotelSummary is a type but HotelID is the variable name), with strings the XML returned is OK. Is it possible to rename the tags to display, for example, OK instead of the datatype? Thanks a lot.
In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)
First, unless you are planning on expanding your status messages later, I would suggest using a boolean. Second, sounds like you might be able to use an enumeration for this:
public enum Status
{
OK,
NOTOK
}Then you would be able to say Status.OK or Status.NOTOK Hope this helps, Chris
-
First, unless you are planning on expanding your status messages later, I would suggest using a boolean. Second, sounds like you might be able to use an enumeration for this:
public enum Status
{
OK,
NOTOK
}Then you would be able to say Status.OK or Status.NOTOK Hope this helps, Chris
Hi Chris, Yes thanks a lot. The enum was exactly what we needed, especially since we are able to expand the responses whenever needed now.
In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)
-
Hi Chris, Yes thanks a lot. The enum was exactly what we needed, especially since we are able to expand the responses whenever needed now.
In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)