Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Building a Generic Data Feed Web Service

, 31 Dec 2010 CPOL
How to build a multi-purpose Web Service for recieving multiple data feeds.
GenericDataFeedService.zip
DataFeed
App_Code
Bin
Imports System.Data
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://pcao.pima.gov/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class Service
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function Send( _
        ByVal feedName As String, _
        ByVal xmlData As String _
    ) As String
        Dim cmd As ACommand
        Dim args As PropertyCollection
        Dim pHandle As System.Runtime.Remoting.ObjectHandle

        Try

            args = New PropertyCollection
            args.Add("xmlData", xmlData)

            Try

                pHandle = System.Activator.CreateInstance("App_Code", "App_Code." & feedName)
                cmd = CType(pHandle.Unwrap, ACommand)

            Catch ex As Exception

                cmd = New CaseElse
                args.Add("feedName", feedName)

            End Try

            cmd.Initialize(feedName)
            Return DirectCast(cmd.Execute(args), String)

        Catch ex As Exception

            Return ex.ToString

        Finally

            pHandle = Nothing
            cmd = Nothing

        End Try

    End Function

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Joe Sweeney
Software Developer (Senior) Pima County Attorney's Office
United States United States
I have over 25 years experience in programming desktop applications and over 10 years in web applications. I've written two books on computer programming: "Hands-On Programming Fundamentals, 2nd Ed" and "Hands-On Design Patterns for Visual Basic, 3rd Ed."

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141220.1 | Last Updated 31 Dec 2010
Article Copyright 2010 by Joe Sweeney
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid