Output XML from a .net webservice

Discussion in 'ASP .Net Web Services' started by Mahesha, Jan 29, 2004.

  1. Mahesha

    Mahesha Guest

    Hello,
    I want to write a .net webservice which returns the data as a xml.
    I get this xml from a dataset by calling GetXml method.This web
    service will be used by clients who donot use .net or microsoft
    platforms. This size of the xml string could be quite big.I would like
    to know whats the best method to return the data.

    a)Should I just return this xml as a string from my webservice.
    b)Is there a better efficient approach to handle this using SOAP.

    I'm a newbie and it would be great if someone could direct me to a
    tutorial/link which can help me on this.

    Regards,
    Mahesha
     
    Mahesha, Jan 29, 2004
    #1
    1. Advertising

  2. Mahesha

    Jan Tielens Guest

    If you're clients are not .NET clients, it's still possible to return custom
    classes for example. So if your only concern is interoperability you may
    want to check out these as well.

    Concerning your question, you can return an XMLDocument. Here's an example:
    http://www.xmlwebservices.cc/index_Samples.htm

    Source:
    <!--StartFragment--><%@ WebService Language="vb" Class="XMLTest" %>

    Imports System.Web.Services
    Imports System.Xml
    Imports System.Xml.Serialization

    <WebService(Namespace:="http://eyesoft.de/webservices/")> _
    Public Class XMLTest
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function _
    GetXML() As System.Xml.XmlDocument
    Dim myXML As New XmlDocument()
    myXML.Load(Server.MapPath(".\") & "AddrBook.xml")

    GetXML = myXML
    End Function
    End Class


    --
    Greetz

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


    "Mahesha" <> wrote in message
    news:...
    > Hello,
    > I want to write a .net webservice which returns the data as a xml.
    > I get this xml from a dataset by calling GetXml method.This web
    > service will be used by clients who donot use .net or microsoft
    > platforms. This size of the xml string could be quite big.I would like
    > to know whats the best method to return the data.
    >
    > a)Should I just return this xml as a string from my webservice.
    > b)Is there a better efficient approach to handle this using SOAP.
    >
    > I'm a newbie and it would be great if someone could direct me to a
    > tutorial/link which can help me on this.
    >
    > Regards,
    > Mahesha
     
    Jan Tielens, Jan 29, 2004
    #2
    1. Advertising

  3. Mahesha

    Trebek Guest

    My advice would be to simply return the string as you are doing. If it
    becomes unreasonably large, I would consider DIME as an alternative, but
    only if the string return doesn't work.

    Alex

    "Mahesha" <> wrote in message
    news:...
    > Hello,
    > I want to write a .net webservice which returns the data as a xml.
    > I get this xml from a dataset by calling GetXml method.This web
    > service will be used by clients who donot use .net or microsoft
    > platforms. This size of the xml string could be quite big.I would like
    > to know whats the best method to return the data.
    >
    > a)Should I just return this xml as a string from my webservice.
    > b)Is there a better efficient approach to handle this using SOAP.
    >
    > I'm a newbie and it would be great if someone could direct me to a
    > tutorial/link which can help me on this.
    >
    > Regards,
    > Mahesha
     
    Trebek, Jan 29, 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. batista
    Replies:
    1
    Views:
    932
    Laurent Bugnion
    Jan 26, 2006
  2. batista
    Replies:
    0
    Views:
    572
    batista
    Jan 26, 2006
  3. Mr. x
    Replies:
    2
    Views:
    722
    Andrew
    Oct 10, 2003
  4. Cyril
    Replies:
    2
    Views:
    4,515
    Cyril
    Jun 1, 2006
  5. Mark B
    Replies:
    1
    Views:
    765
    John Saunders
    Nov 2, 2008
Loading...

Share This Page