Welcome to Forums Sign in | Join | Help | Forums
in Search


Web Service - When to log into RE

Last post 08-10-2007 10:31 AM by Garrett Keating. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 06-07-2006 11:44 AM

    • David Zeidman
    • Top 25 Contributor
    • User Since: 2002
    • Posts 326
    • Organization: Zeidman Development
    • Products:  Blackbaud Direct Marketing, Blackbaud Enterprise CRM, The Information Edge, The Raiser's Edge

    Web Service - When to log into RE

    I am writing a web service for RE. Being a web service novice I was wondering if anyone had written one previously and also when do you log into RE? Clearly you could do it for each web method but this would be time consuming. Is there a way for the web service to stay logged in - some kind of global initialization for the web service where I could log in to RE and then a terminiation were I could log out? All help appreciated. Thanks David Zeidman Development http://www.zeidman.info
    David Zeidman
    Zeidman Development
    http://www.zeidman.info

    Check out my RE API blog
    http://www.re-decoded.com
  • 06-09-2006 10:47 PM In reply to

    Web Service - When to log into RE

    We are experimenting with this now, but one option would be to use the global.asax file to open the API on application start. See the MSDN link for info about the file and how it’s used. Of course you need to be careful about doing this as it will leave and open API object on the web server for the life of the web service. Be sure to test and research this before using this method. Joel http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconGlobalasaxSyntax.asp  Sub Application_OnStart() ' Open REAPI here End Sub Sub Application_OnEnd() ' Close REAPI here. End Sub
  • 06-09-2006 10:47 PM In reply to

    Web Service - When to log into RE

    We are experimenting with this now, but one option would be to use the global.asax file to open the API on application start. See the MSDN link for info about the file and how it’s used. Of course you need to be careful about doing this as it will leave and open API object on the web server for the life of the web service. Be sure to test and research this before using this method. Joel http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconGlobalasaxSyntax.asp  Sub Application_OnStart() ' Open REAPI here End Sub Sub Application_OnEnd() ' Close REAPI here. End Sub
  • 08-09-2007 3:32 PM In reply to

    • Tim Trietley
    • Not Ranked
    • Posts 1
    • Organization: Home School Legal Defense Association

    Web Service - When to log into RE

    Did either of you (John and Joel) make any progess on trying to create an REAPI object just once and then serve it out to other apps? In other words, did you ever establish a web service that creates/inits the REAPI just once, and if so what results did you experience with the web site accessing that one object?
  • 08-10-2007 12:07 AM In reply to

    Web Service - When to log into RE

    Dear David, What type of web service are you writing? We know we're going to have to get into web services in the next few months to link our email list system with RE, but haven't even begun to work out how to do it. Regards, David Wanless.
  • 08-10-2007 8:14 AM In reply to

    • Garrett Keating
    • Top 150 Contributor
    • User Since: 2006
    • Posts 63
    • Organization: U.S. Naval Academy Alumni Association
    • Products:  Blackbaud NetCommunity, The Financial Edge, The Information Edge, The Raiser's Edge

    Web Service - When to log into RE

    We currently do this alot. It's our primary means of putting data back into RE. We learned from some code that Shaun Sullivan demoed and sent around at the conference last year. It was very helpful. Shows you how to init the REAPI object via the webservice and then does a simple demo of how to add a new user to RE via the service, then returns the new constituent ID. We have built most of our web services extensivily from that code sampele. I can't send you the code because it was something the paying conference attendees had access to. Hope that helps a little. Garrett Keating Web Developer United States Naval Academy Alumni Association & Foundation www.usna.com
    Garrett Keating
    Senior Web Developer
    U.S. Naval Academy Alumni Association and Foundation
    www.usna.com
    customizingNetCommunity.com
  • 08-10-2007 9:51 AM In reply to

    • David Zeidman
    • Top 25 Contributor
    • User Since: 2002
    • Posts 326
    • Organization: Zeidman Development
    • Products:  Blackbaud Direct Marketing, Blackbaud Enterprise CRM, The Information Edge, The Raiser's Edge

    Web Service - When to log into RE

    You can find those code samples here: http://www.blackbus.org/forum/downloads.php?do=cat&id=7  Shaun gave his permission for them to be there, I believe. David Zeidman Development http://www.zeidman.info  Check out my RE API blog http://re-decoded.com
    David Zeidman
    Zeidman Development
    http://www.zeidman.info

    Check out my RE API blog
    http://www.re-decoded.com
  • 08-10-2007 10:20 AM In reply to

    Web Service - When to log into RE

    We have decided to store our API object in an application session variable. I'm pretty sure BB would tell you this is not a best practice, but so far it has been working for us. We have found that is takes to long to init the API object each time the web service is called. By leaving the API object open in the session it speeds up the response time of our web service. Obviously by doing this though you always have one user in the database. We created a web method on the web service to recycle the API object. We call this through windows scheduler once a day to keep it from getting out of control. Here is the API class we created. We just call REAPI.Start() anytime we want to use the API to make sure it's loaded. If you do go down this route I recommend good testing and monitoring of resources and performance. We have also written a little class to log all the exception messages we receive on the web service to a DB so we can keep up with what's going on. Joel Imports Microsoft.VisualBasic Imports System.Web.HttpContext Imports Blackbaud.PIA.RE7.REAPI Public Class REAPI Shared ReadOnly Property API() As REAPIClass Get Return Current.Application("REAPI") End Get End Property Shared Sub Start() If REAPI.API Is Nothing Then Current.Application("REAPI") = New REAPIClass REAPI.API.Init( _ "SERIAL", _ REAPI.Settings.Username, _ REAPI.Settings.Password, _ REAPI.Settings.Database, _ "", _ REAPI.Settings.Mode) End If End Sub Shared Sub Kill() If REAPI.API IsNot Nothing Then REAPI.API.CloseDown() Current.Application("REAPI") = Nothing 'Or using the following per Shaun's example 'System.Runtime.InteropServices.Marshal.ReleaseComObject(Current.Application("REAPI")) End If End Sub 'This is optional, we just store these settings in web.config so we can change them easy for Dev environment. Public Class Settings Shared ReadOnly Property Username() As String Get Return (Web.Configuration.WebConfigurationManager.AppSettings("REAPI.Username")) End Get End Property Shared ReadOnly Property Password() As String Get Return (Web.Configuration.WebConfigurationManager.AppSettings("REAPI.Password")) End Get End Property Shared ReadOnly Property Database() As Integer Get Return (Web.Configuration.WebConfigurationManager.AppSettings("REAPI.Database")) End Get End Property Shared ReadOnly Property Mode() As Integer Get Return (Web.Configuration.WebConfigurationManager.AppSettings("REAPI.Mode")) End Get End Property End Class End Class
  • 08-10-2007 10:31 AM In reply to

    • Garrett Keating
    • Top 150 Contributor
    • User Since: 2006
    • Posts 63
    • Organization: U.S. Naval Academy Alumni Association
    • Products:  Blackbaud NetCommunity, The Financial Edge, The Information Edge, The Raiser's Edge

    Web Service - When to log into RE

    thanks for the info. We're starting to run into problems with init time. This is a great solution thanks! Garrett Keating Web Developer United States Naval Academy Alumni Association & Foundation www.usna.com
    Garrett Keating
    Senior Web Developer
    U.S. Naval Academy Alumni Association and Foundation
    www.usna.com
    customizingNetCommunity.com
Page 1 of 1 (9 items)