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)*** Load the Proxy and Support Class LibrariesDO AuthoriserProxy.prg*** Create an instance of the Proxy THISFORM.Authoriser = CREATEOBJECT("AuthoriserProxy") && Optionally specify .NET Version (form.getcard-method - simplified)LOCAL llResult, lnSaldo, lnTransactieID, lnResultCode, lcResultDescription llResult=.F. lnSaldo=0 * Saldo ophalen *** Downloads an object - GetCardData itemLOCAL 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)*** Check for Errors if necessaryIF 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 && Succes 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 *** Downloads an object - PurchaseData itemLOCAL 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)*** Check for Errors if necessaryIF 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 && Succes 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 lnValue* SET PATH TO ".\AuthoriserProxy" ADDITIVEDO AuthoriserProxy.prgLOCAL loService, loItem, lnSaldo loService=CREATEOBJECT("AuthoriserProxy") && Optionally specify .NET Version loItem = loService.purchase("THECARD","IKKE","MYFIRM","123456",;"Transact1","FM","1234567890123456789","", lnValue*100,"POS")*** Check for Errors if necessaryIF 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 && Succes 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?