Returning XML from a web service

Discussion in 'ASP .Net Web Services' started by akosz, Jun 7, 2004.

  1. akosz

    akosz Guest

    We have a web service that basically does as follows

    <WebMethod()>
    Public Function Verify(ByRef strXML As String) As Intege

    Dim iRetCode As Integer = 0

    iRetCode = DoStuff(strXML
    If (iRetCode < 0) The
    Return iRetCod
    End I

    Return iRetCod
    End Functio

    This works fine when we use a VB.NET or ColdFusion test app to send or receive XML. However, some of our customers who aren't using VB or CF are having the XML returned to them using entity references ( such as: &lt; and &gt; ). If we change the code to

    <WebMethod()>
    Public Function Verify(ByRef strXML As String) As Intege

    Dim iRetCode As Integer = 0

    iRetCode = DoStuff(strXML
    If (iRetCode < 0) The
    strXML = "<![CDATA[" + strXML + "]]>
    Return iRetCod
    End I

    strXML = "<![CDATA[" + strXML + "]]>
    Return iRetCod
    End Functio

    It eliminates their problem, but now the CF and VB.NET test apps of ours are blowing up

    Any suggestions on how to return XML that is universally readable

    akos
    akosz, Jun 7, 2004
    #1
    1. Advertising

  2. don't return it (or pass it) as a string!
    pass it as an XmlElement.

    check this article to see how:
    http://msdn.microsoft.com/library/en-us/dnservice/html/service04162003.asp

    -Dino

    "akosz" <> wrote in message
    news:...
    > We have a web service that basically does as follows:
    >
    > <WebMethod()> _
    > Public Function Verify(ByRef strXML As String) As Integer
    >
    > Dim iRetCode As Integer = 0
    >
    > iRetCode = DoStuff(strXML)
    > If (iRetCode < 0) Then
    > Return iRetCode
    > End If
    >
    > Return iRetCode
    > End Function
    >
    > This works fine when we use a VB.NET or ColdFusion test app to send or

    receive XML. However, some of our customers who aren't using VB or CF are
    having the XML returned to them using entity references ( such as: &lt; and
    &gt; ). If we change the code to:
    >
    > <WebMethod()> _
    > Public Function Verify(ByRef strXML As String) As Integer
    >
    > Dim iRetCode As Integer = 0
    >
    > iRetCode = DoStuff(strXML)
    > If (iRetCode < 0) Then
    > strXML = "<![CDATA[" + strXML + "]]>"
    > Return iRetCode
    > End If
    >
    > strXML = "<![CDATA[" + strXML + "]]>"
    > Return iRetCode
    > End Function
    >
    > It eliminates their problem, but now the CF and VB.NET test apps of ours

    are blowing up.
    >
    > Any suggestions on how to return XML that is universally readable?
    >
    > akosz
    >
    Dino Chiesa [Microsoft], Jun 7, 2004
    #2
    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. Toby Mathews

    Returning my object(s) from web service

    Toby Mathews, Oct 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,116
    Toby Mathews
    Oct 28, 2003
  2. Replies:
    11
    Views:
    648
    Christos Georgiou
    May 2, 2006
  3. Curly
    Replies:
    0
    Views:
    188
    Curly
    Aug 19, 2003
  4. Nastero

    Web Service Help for a Noob : Returning an XML String

    Nastero, Mar 29, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    151
    jerome
    Mar 31, 2005
  5. Leo Violette
    Replies:
    0
    Views:
    998
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page