Results 1 to 3 of 3

Thread: XML Web Service - how to reply with xml?

  1. #1

    Thread Starter
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    XML Web Service - how to reply with xml?

    Righty. I can get the information via xml to my service - but how I reply with xml too?

    VB Code:
    1. <WebMethod()> _
    2.     Public Function AcceptSMS(ByVal oanumber As String, ByVal danumber As String, ByVal udstring As String) As String
    3.         Dim strRetVal As String = ""
    4.         strRetVal = "Passed data : <br>"
    5.         strRetVal &= oanumber & "<br>"
    6.         strRetVal &= danumber & "<br>"
    7.         strRetVal &= udstring & "<br>"
    8.         Return strRetVal
    9.     End Function

    That will reply with just text, but I need to format it in proper xml. How do I reply properly...?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    Re: XML Web Service - how to reply with xml?

    Originally posted by plenderj
    Righty. I can get the information via xml to my service - but how I reply with xml too?

    VB Code:
    1. <WebMethod()> _
    2.     Public Function AcceptSMS(ByVal oanumber As String, ByVal danumber As String, ByVal udstring As String) As String
    3.         Dim strRetVal As String = ""
    4.         strRetVal = "Passed data : <br>"
    5.         strRetVal &= oanumber & "<br>"
    6.         strRetVal &= danumber & "<br>"
    7.         strRetVal &= udstring & "<br>"
    8.         Return strRetVal
    9.     End Function

    That will reply with just text, but I need to format it in proper xml. How do I reply properly...?
    The webservice will take the string, wrap xml around it, and send it back. That is it, unless you want the string itself to contain XML, then you just do the formatting yourself.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Another thing you can do is create a serializable object, populate the properties of it, and return that. The webservice will serialize the object to xml for you, and return it.

Posting Permissions

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



Click Here to Expand Forum to Full Width