The error message you see is in dutch because it comes from .NET which will return the error message in the local machine's culture context which on your machine is dutch.
Another thing that could be a problem is the type of the number. FoxPro numbers pass through as double values. What's the type of the numeric value expected? You might have to cast the value explicitly or use the ComValue() potentially. IOW, assigning the value to a variable and pass that then CAST(lnValue as integer) or whatever is needed.
Sometimes it can also help to call oBridge.InvokeMethod() instead of calling the method directly as wwDotnetBridge does some automatic fixups for some problematic values and conversions. Doesn't always help, but it can.
Hi Rick,
Perhaps you can help me out. I'm making an app to consume a webservice for creditmanagement, using your Web Service Proxy generator. I constructed a proxy with the generator: authoriserproxy.prg. I placed this prg with the other depending prgs/dlls in a new folder authoriserproxy of my main project folder. There are 2 relevant methods: getsaldo and purchase. The getsaldo ("saldo"=balance) method works fine using this code:
(form.init)DO AuthoriserProxy.prg
THISFORM.Authoriser = CREATEOBJECT("AuthoriserProxy")
(form.getcard-method - simplified)LOCAL llResult, lnSaldo, lnTransactieID, lnResultCode, lcResultDescription
llResult=.F.
lnSaldo=0
LOCAL loItem as GetCardData, lcTransact
lcTransact=GETKEY("Transact")
loItem = THISFORM.Authoriser.GetCard(THISFORM.CardType,THISFORM.Requestor,THISFORM.ClientID,THISFORM.ClientPassword,;
TRIMSTR(OBJ_NUM(lcTransact)),THISFORM.ClientReference,THISFORM.Pages.Transacties.txtNummer.Value,"",THISFORM.MsgVersion)IF THISFORM.Authoriser.lError
THISFORM.Melding("Saldo opvragen mislukt:"+CR+THISFORM.Authoriser.cErrorMsg,"Rood",0)ELSE
lnTransactieID=THISFORM.Authoriser.oBRIDGE.getproperty(loitem,"transactionid")
lnResultCode=loItem.ResultCode
lcResultDescription=loitem.ResultDescriptionIF lnResultCode=0
lnSaldo=THISFORM.Authoriser.oBRIDGE.getproperty(loitem,"balance")/100
llResult=.T.ELSE
THISFORM.Melding("Foutmelding "+TRIMSTR(lnResultCode),"Rood",0) ENDIF
THISFORM.Saldo=lnSaldo
RETURN llResult
As said above code works as expected. So I figured that calling the other method would be simple.
(form.purchase-method - simplified)LOCAL llResult, lnSaldo, lnTransactieID, lnResultCode, lcResultDescription, lnWaarde, loService
lnWaarde=VAL(THISFORM.Pages.Transacties.txtWaarde.Value)*100
loService=THISFORM.Authoriser
llResult=.F.
lnSaldo=THISFORM.Saldo
LOCAL loItem as PurchaseData, lcTransact
lcTransact=GETKEY("Transact")
loItem = loService.purchase(THISFORM.CardType,THISFORM.Requestor,THISFORM.ClientID,THISFORM.ClientPassword,;
TRIMSTR(OBJ_NUM(lcTransact)),THISFORM.ClientReference,THISFORM.Pages.Transacties.txtNummer.Value,"",;
lnWaarde,THISFORM.MsgVersion)IF loService.lError
THISFORM.Melding("Afwaarderen mislukt:"+CR+loService.cErrorMsg,"Rood",0) ELSE
lnTransactieID=loService.oBRIDGE.getproperty(loitem,"transactionid")
lnResultCode=loItem.ResultCode
lcResultDescription=loitem.ResultDescriptionIF lnResultCode=0
lnSaldo=loService.oBRIDGE.getproperty(loitem,"cardnewbalance")/100
llResult=.T.ELSE
THISFORM.Melding("Afwaarderen, foutmelding "+TRIMSTR(lnResultCode),"Rood",0) ENDIFENDIF
THISFORM.Saldo=lnSaldo
RETURN llResult
For the purchase-call however loService.lError returned .T. AND loService.cErrorMsg returned "Methode Authoriser.Authoriser.Purchase is niet gevonden..." (=Method .... not found). I then set a breakpoint to inspect the loService-object and intellisense showed its Purchase-method. So I tried typing the purchase-call directly from the command window and the webservice was called correctly. But after continuing and tracing the loService.purchase()-call in the above code the "invokemethod"-call generated the error I mentioned. strange: what's different from calling it from the Command-window in debug-mode?
And where is this dutch errormsg coming from?
I finally wrote a standalone prg to test the purchase call
(standalone purchase.prg)LPARAMETERS lnValueDO AuthoriserProxy.prgLOCAL loService, loItem, lnSaldo
loService=CREATEOBJECT("AuthoriserProxy")
loItem = loService.purchase("THECARD","IKKE","MYFIRM","123456",;"Transact1","FM","1234567890123456789","", lnValue*100,"POS")IF loService.lError
AppMsg("Afwaarderen mislukt:"+CR+loService.cErrorMsg,"Mislukt","X")ELSE
lnTransactieID=loService.oBRIDGE.getproperty(loitem,"transactionid")
lnResultCode=loItem.ResultCode
lcResultDescription=loitem.ResultDescriptionIF lnResultCode=0
lnSaldo=loService.oBRIDGE.getproperty(loitem,"cardnewbalance")/100
llResult=.T.
AppMsg("Nieuw saldo:"+TRIMSTR(lnSaldo),"Geslaagd","I")ELSE
AppMsg("Afwaarderen, foutmelding "+TRIMSTR(lnResultCode)),"Mislukt","X")ENDIFENDIF
When I call this program from the Command-window with the command
DO purchase WITH 1
everything works fine.
But when I put it in the click()-code of a form-button like:
Purchase(lnWaarde)
oBridge.Invokemethod again generates the dutch error message.
Any idea what is causing this behaviour?