Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   My .Net Wrapper Class Fails when accessed with a Web Service (http://www.velocityreviews.com/forums/t781679-my-net-wrapper-class-fails-when-accessed-with-a-web-service.html)

Dave Capper 09-10-2003 05:13 PM

My .Net Wrapper Class Fails when accessed with a Web Service
 
Hi,

I've got a problem with a class that I have written to wrap up access to an
API. Basically, the wrapper instantiates an old COM API, and then executes
its login method, which has a system DSN as a parameter. This wrapper works
fine when I use it in a Windows application, i.e. the login method works
correctly resulting in the API being logged into the database.

When I try to put a webservice front-end onto this class the login method
fails.

I am guessing that the problem comes from the web service accessing the DSN,
but it is only a guess. Is there any way around this? Is it a security
setting that prevents the DSN being accessed?

Please help!

Cheers,
Dave

P.S. In the code below, bLoggedIn returns true for the Windows application,
but false for the Web Service.

Here is the basics of the code:

WRAPPER CLASS

Public Class HEATWrapper
Private hwsIT As haWorkspace 'This will be the single reference to HEAT
Private Const sUserName As String = "xxxx"
Private Const sPassword As String = "xxxx"
Private Const sDSN As String = "MHD_DSN"

Public Sub New()
End Sub

Private Function GetConnection() As haWorkspace
Dim bLoggedIn As Boolean = False

'Login to HEAT Application
If hwsIT Is Nothing Then
hwsIT = New haWorkspace
End If
If Not hwsIT.LoggedIn Then
bLoggedIn = hwsIT.Login(sUserName, sPassword, sDSN)
End If
If bLoggedIn Then
Return hwsIT
Else
Return Nothing
End If
End Function

Public Function GetCustomerID(ByVal strCustomerType As String, ByVal
strEmail As String, ByVal strCustName As String) As String
Dim objHEAT As haWorkspace

Try
objHEAT = GetHEATConnection()
...
Catch ex As Exception
Throw ex
End Try
End Function

<Various other functions to expose the API methods>
End Class

WINDOWS APPLICATION:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim hwHEAT As New HEATWrapper

Try
MessageBox.Show(hwHEAT.GetCustomerID("Customer", "",
"CustomerName"))
Catch ex As Exception
Throw ex
End Try
End Sub

WEB METHOD
<WebMethod()> Public Function GetCustomerID(ByVal strCustName As String)
As String
Dim hwHEAT As New HEATWrapper

Try
Return hwHEAT.GetCustomerID("Customer", "", strCustName)
Catch ex As Exception
Throw ex
End Try
End Function





All times are GMT. The time now is 12:48 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.