Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Web Service XML Tag Rename

Web Service XML Tag Rename

Scheduled Pinned Locked Moved C#
wcfxmlhelptutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    il_manti
    wrote on last edited by
    #1

    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)

    N C 2 Replies Last reply
    0
    • I il_manti

      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)

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      il_manti wrote:

      but I want one of them to just return a 'string' (either "OK" or "NOTOK").

      Why not use bool then? Return True/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

      1 Reply Last reply
      0
      • I il_manti

        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)

        C Offline
        C Offline
        c2423
        wrote on last edited by
        #3

        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

        I 1 Reply Last reply
        0
        • C c2423

          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

          I Offline
          I Offline
          il_manti
          wrote on last edited by
          #4

          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)

          C 1 Reply Last reply
          0
          • I il_manti

            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)

            C Offline
            C Offline
            c2423
            wrote on last edited by
            #5

            Glad to have helped! :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups