Page 1 of 1

Help to access Web Service

Posted: Mon Sep 28, 2009 6:57 pm
by toninhofwi
Hi friends,

I'm trying to access Web Services using fivewin, but I receive an error in OLE creation:

---cut---
local oSoapClient, cBuf
oSoapClient := Win_OleCreateObject( "MSSOAP.SoapClient30" )
oSoapClient:msSoapInit( "https://www.nfp.sp.gov.br/ws" )
---cut---

The manual for WS that I need access is this: http://www.nfp.fazenda.sp.gov.br/pdf/webservice.pdf


Any hint please ?

Thanks and best regards,

Toninho.

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 9:03 am
by Antonio Linares
Toninho,

Try using CreateObject():

CreateObject( "MSSOAP.SoapClient30" )

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 10:11 am
by toninhofwi
Hi Antonio.

Same error, in mssoapinit. IMHO is time to FWH goes to web. FWH is a powerfull product but we live in a time that web is required for a lot of transactions. Web Services in more and more used and soap was replaced by net framework. Is my dream a day that FWH have a TWeb class... :wink:

Thank you and best regards,

Toninho.

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 10:42 am
by norberto
Toninho, i agree... can we try to make one? (im from brazil too). i need webservices too.

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 12:51 pm
by toninhofwi
Hi Norberto.

Of course yes, please add me in msn: toninho@fwi.com.br

Regards.

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 12:58 pm
by Colin Haig
static function Convert(oPo)
Local oSoap := Mcs_OleObj("MSSOAP.SoapClient30")
Local nRate := nil,nAmount := 0,cTo := 'AUD',cCurr := '',nCurrRate := 0,lCont := TRUE
nCurrRate := oPo:rate()
if nCurrRate <> 0
if ! MsgNoYes('Changing Rate - Are You Sure ?')
lCont := FALSE
endif
endif
if lCont
nAmount := oPo:us
cCurr := oPo:curr
CursorWait()
oSoap:MsSoapInit("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL")
oSoap:ClientProperty("ServerHTTPRequest")
nRate := oSoap:ConversionRate(substr(cCurr,1,3),substr(cTo,1,3))
oSoap := nil
nAmount := nAmount * nRate
oPo:aud := nAmount
oPo:rate := nRate
oPo:save()
SndPlaySound("Ding",1)
CursorArrow()
endif
Return nil
//--------------------------------------------------------------------------------------------------------//
Please note the code relating to SOAP came from Byron - form Matrix Software ( from memory)

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 2:49 pm
by James Bott

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 4:30 pm
by toninhofwi
Hi James,

Thanks for your hint. I'm playing with WinInet for some days, but instead InternetReadFile(), I think that I need InternetWriteFile(), but it is not so easy to use, please see at msdn and another problem, I need use SOAP protocol, or ws will reject my request...

Regards,

Toninho.

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 4:31 pm
by toninhofwi
Hi Colin,

I'm trying your sample, thanks a lot.

Toninho.

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 4:51 pm
by toninhofwi
I think that I found the problem, I need access a HTTPS...

oSoapClient:msSoapInit( "https://www.nfp.fazenda.sp.gov.br/ws/ar ... .asmx?WSDL" )

Anybody know if MSSOAP access HTTPS ???


Thanks and best regards,

Toninho.

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 5:40 pm
by Antonio Linares

Re: Help to access Web Service

Posted: Tue Sep 29, 2009 7:46 pm
by toninhofwi
Thanks Antonio,

I'll review it.

Regards,

Toninho.