XML Feed

Discussion in 'ASP .Net' started by Steve Peterson, Dec 25, 2004.

  1. Hello

    I need to provide a live XML feed from my web application to a 3rd party.
    The 3rd party needs data from our database in XML format which will be
    fromatted & presented on a web page sort of an RSS scenario. The problem is
    I'm not sure how to to provide a dynamic XML file, or rather the latest data
    will be returned as XML to the 3rd party.

    I'm assuming this is a good scenario for a web service, but have no clue
    where to begin. If anyone has faced this before & could point me in the
    right direction to read up on this, I would appreciate it.

    TIA
    Steve
     
    Steve Peterson, Dec 25, 2004
    #1
    1. Advertising

  2. Hi Steve,

    Yes, a Web service would be a good way to go to provide XML. Here's a quick
    example of how you can return a dataset that is very usable XML by anyone
    who knows that they are doing:

    ' filename: wsdata.asmx

    <%@ WebService Language="vb" Codebehind="wsdata.asmx.vb"
    Class="p4320work.wsdata" %>


    'filename: wsdata.asmx.vb
    Imports System.Web.Services

    <System.Web.Services.WebService(Namespace :=
    "http://tempuri.org/p4320work/wsdata")> _
    Public Class wsdata
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function SendData() As DataSet
    Return CreateDataSource()
    End Function
    Function CreateDataSource() As DataSet
    Dim dt As New DataTable
    Dim dr As DataRow
    Dim ds As New DataSet
    dt.Columns.Add(New DataColumn _
    ("IntegerValue", GetType(Int32)))
    dt.Columns.Add(New DataColumn _
    ("StringValue", GetType(String)))
    dt.Columns.Add(New DataColumn _
    ("CurrencyValue", GetType(Double)))
    dt.Columns.Add(New DataColumn _
    ("Boolean", GetType(Boolean)))
    Dim i As Integer
    For i = 0 To 8
    dr = dt.NewRow()
    dr(0) = i
    dr(1) = "Item " + i.ToString()
    dr(2) = 1.23 * (i + 1)
    dr(3) = (i = 4)
    dt.Rows.Add(dr)
    Next i
    ds.Tables.Add(dt)
    Return ds
    End Function 'CreateDataSource
    End Class

    Ken
    Microsoft MVP [ASP.NET]
    Toronto


    "Steve Peterson" <> wrote in message
    news:...
    > Hello
    >
    > I need to provide a live XML feed from my web application to a 3rd party.
    > The 3rd party needs data from our database in XML format which will be
    > fromatted & presented on a web page sort of an RSS scenario. The problem
    > is I'm not sure how to to provide a dynamic XML file, or rather the latest
    > data will be returned as XML to the 3rd party.
    >
    > I'm assuming this is a good scenario for a web service, but have no clue
    > where to begin. If anyone has faced this before & could point me in the
    > right direction to read up on this, I would appreciate it.
    >
    > TIA
    > Steve
    >
     
    Ken Cox [Microsoft MVP], Dec 25, 2004
    #2
    1. Advertising

  3. Thanks Ken

    I appreciate you taking the time to reply on Christmas!

    Steve


    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:...
    > Hi Steve,
    >
    > Yes, a Web service would be a good way to go to provide XML. Here's a
    > quick example of how you can return a dataset that is very usable XML by
    > anyone who knows that they are doing:
    >
    > ' filename: wsdata.asmx
    >
    > <%@ WebService Language="vb" Codebehind="wsdata.asmx.vb"
    > Class="p4320work.wsdata" %>
    >
    >
    > 'filename: wsdata.asmx.vb
    > Imports System.Web.Services
    >
    > <System.Web.Services.WebService(Namespace :=
    > "http://tempuri.org/p4320work/wsdata")> _
    > Public Class wsdata
    > Inherits System.Web.Services.WebService
    >
    > <WebMethod()> _
    > Public Function SendData() As DataSet
    > Return CreateDataSource()
    > End Function
    > Function CreateDataSource() As DataSet
    > Dim dt As New DataTable
    > Dim dr As DataRow
    > Dim ds As New DataSet
    > dt.Columns.Add(New DataColumn _
    > ("IntegerValue", GetType(Int32)))
    > dt.Columns.Add(New DataColumn _
    > ("StringValue", GetType(String)))
    > dt.Columns.Add(New DataColumn _
    > ("CurrencyValue", GetType(Double)))
    > dt.Columns.Add(New DataColumn _
    > ("Boolean", GetType(Boolean)))
    > Dim i As Integer
    > For i = 0 To 8
    > dr = dt.NewRow()
    > dr(0) = i
    > dr(1) = "Item " + i.ToString()
    > dr(2) = 1.23 * (i + 1)
    > dr(3) = (i = 4)
    > dt.Rows.Add(dr)
    > Next i
    > ds.Tables.Add(dt)
    > Return ds
    > End Function 'CreateDataSource
    > End Class
    >
    > Ken
    > Microsoft MVP [ASP.NET]
    > Toronto
    >
    >
    > "Steve Peterson" <> wrote in message
    > news:...
    >> Hello
    >>
    >> I need to provide a live XML feed from my web application to a 3rd party.
    >> The 3rd party needs data from our database in XML format which will be
    >> fromatted & presented on a web page sort of an RSS scenario. The problem
    >> is I'm not sure how to to provide a dynamic XML file, or rather the
    >> latest data will be returned as XML to the 3rd party.
    >>
    >> I'm assuming this is a good scenario for a web service, but have no clue
    >> where to begin. If anyone has faced this before & could point me in the
    >> right direction to read up on this, I would appreciate it.
    >>
    >> TIA
    >> Steve
    >>

    >
     
    Steve Peterson, Dec 26, 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. Bruce W..1

    How to make a blog with an XML feed?

    Bruce W..1, Dec 2, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    644
    Bruce W..1
    Dec 3, 2003
  2. =?Utf-8?B?UmFlZCBTYXdhbGhh?=

    Line Feed & Carriage Return with XML?

    =?Utf-8?B?UmFlZCBTYXdhbGhh?=, Oct 25, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    12,095
    Kevin Spencer
    Oct 25, 2004
  3. Guest
    Replies:
    3
    Views:
    549
    Jason Kester
    Oct 27, 2005
  4. csgraham74

    XML Feed Dotnet

    csgraham74, Mar 1, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    430
    csgraham74
    Mar 7, 2006
  5. KiwiBrian
    Replies:
    3
    Views:
    1,125
    Martin
    Mar 8, 2005
Loading...

Share This Page