Passing XML in a string parameter

Discussion in 'ASP .Net Web Services' started by Ryan Champlin, Jan 13, 2004.

  1. 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, Jan 13, 2004
    #1
    1. Advertising

  2. 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, Jan 13, 2004
    #2
    1. Advertising

  3. Ryan Champlin

    Jan Tielens Guest

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

    --
    Greetz

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


    "Ryan Champlin" <> wrote in message
    news:09c801c3d9e0$19edea70$...
    > 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, Jan 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3RldmVuIEouIFJlZWQ=?=

    Passing XML as parameter to Web page

    =?Utf-8?B?U3RldmVuIEouIFJlZWQ=?=, Jan 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    4,608
    =?Utf-8?B?U3RldmVuIEouIFJlZWQ=?=
    Jan 22, 2005
  2. goldtech
    Replies:
    5
    Views:
    379
    goldtech
    Sep 1, 2007
  3. Kee Nethery
    Replies:
    12
    Views:
    2,043
    Stefan Behnel
    Jun 27, 2009
  4. Mister B
    Replies:
    8
    Views:
    528
    Nick Keighley
    Aug 26, 2010
  5. Peter

    Passing parameter using XML data

    Peter, Dec 4, 2003, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    114
Loading...

Share This Page