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. Advertisements

  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. Advertisements

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. hocho888
    Replies:
    1
    Views:
    844
  2. Michael Averstegge
    Replies:
    0
    Views:
    4,518
    Michael Averstegge
    Jan 10, 2006
  3. Not Me
    Replies:
    1
    Views:
    3,446
    Not Me
    Jun 5, 2007
  4. Isaias Formacio Serna

    Web Service that calls an external Web Service

    Isaias Formacio Serna, Jan 28, 2004, in forum: ASP .Net Security
    Replies:
    5
    Views:
    450
  5. Replies:
    1
    Views:
    389
    Joe Kaplan \(MVP - ADSI\)
    Jun 14, 2006
  6. Curly
    Replies:
    0
    Views:
    256
    Curly
    Aug 19, 2003
  7. Nastero

    Web Service Help for a Noob : Returning an XML String

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