Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: wwDotNetBridge - logon fail

$
0
0
Re: wwDotNetBridge - logon fail
VFP and .NET Interop
Re: wwDotNetBridge - logon fail
04/13/2012
02:09:06 PM
3H80UBYHT Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None
Brian,

It sounds like wwDotNetBridge is doing it's job. I can't speak to Sage but that you have to take up with them.

If you're getting a result back or there is no error message (ALWAYS check cErrorMsg or the result value after calls) then wwDotNetBridge calls are going through. Errors don't throw when you call InvokeMethod, so if something goes wrong you have to check the return value of the method (if that indicates failure) or check cErrroMsg.

FWIW, you should also be able to call this method directly:

oApplication = oBridge.CreateInstance('Sage.Accounting.Application') lvReuslt = oApplication.Connect(cName, cPass)

since there are no specific parameters or return values (?) that are problematic for FoxPro. If you call it this way any error will throw a FoxPro error that you can check.

+++ Rick ---


Hi

I'm trying to use wwDotNetBridge to interface with Sage 200 accounts (.net 3.5). I'm failing at almost the first hurdle - logging on to Sage 200.

Having loaded the relevant Sage 200 assemblies, I then do this:

LOCAL oApplication As Sage.Accounting.Application cName = 'TEST2' cPass = 'test2' oApplication = oBridge.CreateInstance('Sage.Accounting.Application') oBridge.InvokeMethod(oApplication, 'Connect', cName, cPass)

... which follows this VB.Net code example:

' Declare the Application object used to connect. Dim application As Sage.Accounting.Application = Nothing application = New Sage.Accounting.Application ' Use the Connect method passing the username and password as strings) application.Connect("John", "orange")

Superficially this works (ie no error thrown) and if I open the Sage 200 Admin Console TEST2 is shown as an active user. However, the logon has in fact failed. When I dig around, I find that Sage.MMS.SAA.Client.ConnectionState returns 0 (not logged on) and the message 'Unable to authenticate user'.

Sage support has this to say:

As you’re not getting any error back when you call Connect, I assume that the username and password are correct.

- Are you able to log into the client UI with those details?

- Are you running your code on a web service / web site or via a WPF application?

- Are you running our connection and activecompany code across different threads?

.. to which the answer is yes, no, no.

Can anyone shed any light on why this is failing?

Thanks



Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii

Viewing all articles
Browse latest Browse all 10393

Trending Articles