Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > XML Feed

Reply
Thread Tools

XML Feed

 
 
Steve Peterson
Guest
Posts: n/a
 
      12-25-2004
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


 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      12-25-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
 
 
 
Steve Peterson
Guest
Posts: n/a
 
      12-26-2004
Thanks Ken

I appreciate you taking the time to reply on Christmas!

Steve


"Ken Cox [Microsoft MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you get feed discovery to work? I go to web pages I know has feeds, but the feed discovery button is disabled. Help! Tim Bryant Computer Support 1 02-13-2007 05:01 AM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
RSS feed <> sql server <> aspx <> xml <> blog ASP .Net 3 10-27-2005 09:14 PM
Line Feed & Carriage Return with XML? =?Utf-8?B?UmFlZCBTYXdhbGhh?= ASP .Net 2 10-25-2004 02:07 PM
How to make a blog with an XML feed? Bruce W..1 ASP .Net 4 12-03-2003 05:47 PM



Advertisments