Passing XML in a string parameter

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Passing XML in a string parameter


    We have a parameter to a webmethod that is defined as a
    string. We expect to pass XML in this string. What we've
    found out is that the .Net web serivce seems to expect the
    string to be in an htmlencoded format. By this I mean all
    the characters such as "<", ">", "=" etc.. need to be
    escaped such as &lt; and &gt; etc.. Why is it that .Net
    seems to expect this? I'm assuming this is part of the
    spec. somewhere that strings need to be encoded (I'm
    guessing for de-serialization reasons when using a
    parser). If anyone can point me to that in a spec
    somewhere that would be helpful so I can explain why this
    is happening.

    Everything works fine when we make sure we pass this
    string htmlencoded.

    Thanks
    Ryan
    Ryan Champlin Guest

  2. Similar Questions and Discussions

    1. Query string and Parameter Passing Problem
      Hi In the context of a Master/Detail scenario, I am having trouble figuring out the correct syntax for passing a parameter in a query string in a...
    2. Passing a parameter in SWF
      In the sample application that comes with flash mx, when I click on the simpleconnect and look at parameters it has an Application Directory and if...
    3. Passing in a parameter
      Hello All, I've declared my usercontrol in the normal way (page directive) and to load it I'm doing: <webapp:menu runat="server" />. However, is...
    4. Passing a Large String as a parameter to a web service
      Hello I have a situation where I might pass a large string as a parameter to a webservice. The string size could go upto 100 MB. Is there a...
    5. Passing Unicode String as Web Method Parameter
      All web requests and responses by default under ASP.NET are sent as unicode and are encoded as unicode UTF8. This can be changed in the...
  3. #2

    Default Passing XML in a string parameter

    I think I may have found the answer but could someone
    verify that i am correct on this. From what I can tell
    the SOAP spec. says that a type of string follows the XML
    Schema specification for a string type. The string type
    for an XML Schema says that this string contain contain
    child elements thus the charaters that typically make up
    element tags (such as < or >) are not allowed or basically
    need to be converted to their escaped equivalent.

    Ryan
    >-----Original Message-----
    >
    >We have a parameter to a webmethod that is defined as a
    >string. We expect to pass XML in this string. What
    we've
    >found out is that the .Net web serivce seems to expect
    the
    >string to be in an htmlencoded format. By this I mean
    all
    >the characters such as "<", ">", "=" etc.. need to be
    >escaped such as < and > etc.. Why is it that .Net
    >seems to expect this? I'm assuming this is part of the
    >spec. somewhere that strings need to be encoded (I'm
    >guessing for de-serialization reasons when using a
    >parser). If anyone can point me to that in a spec
    >somewhere that would be helpful so I can explain why this
    >is happening.
    >
    >Everything works fine when we make sure we pass this
    >string htmlencoded.
    >
    >Thanks
    >Ryan
    >.
    >
    Ryan Champlin Guest

  4. #3

    Default Re: Passing XML in a string parameter

    That's right, otherwise you'd end up with invalid xml.

    --
    Greetz

    Jan Tielens
    ________________________________
    Read my weblog: [url]http://weblogs.asp.net/jan[/url]


    "Ryan Champlin" <anonymous@discussions.microsoft.com> wrote in message
    news:09c801c3d9e0$19edea70$a501280a@phx.gbl...
    > I think I may have found the answer but could someone
    > verify that i am correct on this. From what I can tell
    > the SOAP spec. says that a type of string follows the XML
    > Schema specification for a string type. The string type
    > for an XML Schema says that this string contain contain
    > child elements thus the charaters that typically make up
    > element tags (such as < or >) are not allowed or basically
    > need to be converted to their escaped equivalent.
    >
    > Ryan
    > >-----Original Message-----
    > >
    > >We have a parameter to a webmethod that is defined as a
    > >string. We expect to pass XML in this string. What
    > we've
    > >found out is that the .Net web serivce seems to expect
    > the
    > >string to be in an htmlencoded format. By this I mean
    > all
    > >the characters such as "<", ">", "=" etc.. need to be
    > >escaped such as < and > etc.. Why is it that .Net
    > >seems to expect this? I'm assuming this is part of the
    > >spec. somewhere that strings need to be encoded (I'm
    > >guessing for de-serialization reasons when using a
    > >parser). If anyone can point me to that in a spec
    > >somewhere that would be helpful so I can explain why this
    > >is happening.
    > >
    > >Everything works fine when we make sure we pass this
    > >string htmlencoded.
    > >
    > >Thanks
    > >Ryan
    > >.
    > >

    Jan Tielens Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139