Professional Web Applications Themes

Passing XML in a string parameter - ASP.NET Web Services

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 pr). If anyone ...

  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
    pr). 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. #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
    >pr). 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

  3. #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" <anonymousdiscussions.microsoft.com> wrote in message
    news:09c801c3d9e0$19edea70$a501280aphx.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
    > >pr). 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

Similar Threads

  1. Query string and Parameter Passing Problem
    By Paul Gray via DotNetMonster.com in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: May 14th, 04:00 PM
  2. Passing in a parameter
    By Jon in forum ASP.NET Building Controls
    Replies: 3
    Last Post: February 9th, 03:39 PM
  3. parameter passing from asp to php
    By PIII450@HOME.NL in forum PHP Development
    Replies: 3
    Last Post: December 4th, 02:39 PM
  4. Passing a Large String as a parameter to a web service
    By Ashok Subramanian in forum ASP.NET Web Services
    Replies: 1
    Last Post: November 9th, 08:37 PM
  5. Passing Unicode String as Web Method Parameter
    By Ben in forum ASP.NET Web Services
    Replies: 0
    Last Post: July 9th, 08:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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