FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Soap Web Service - timeout request
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Soap Web Service - timeout request
Posted: Mon Jan 08, 2024 09:13 PM

Hello,

It is possible to set a timeout request for a web service request? I added to IF oHttp:status=200 to check status but sometimes request hangs.

TRY

oHttp := CreateObject( 'MSXML2.XMLHTTP' )

CATCH

oHttp := CreateObject( 'Microsoft.XMLHTTP' )

END

cHttpSend := [<?xml version="1.0"?>]

cHttpSend += [<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:abc.com:05-OfferToCash:40-LogisticDelivery">]

cHttpSend += [ <soapenv:Header/>]

cHttpSend += [ <soapenv:Body>]

cHttpSend += [ <urn:FindRFIDQry>]

cHttpSend += [ <!--Optional:-->]

cHttpSend += [ <Header>]

cHttpSend += [ <!--Optional:-->]

cHttpSend += [ <Document>] + cSDNo + [</Document>]

cHttpSend += [ <!--Optional:-->]

cHttpSend += [ <OutboundDelivery></OutboundDelivery>]

cHttpSend += [ </Header>]

cHttpSend += [ </urn:FindRFIDQry>]

cHttpSend += [ </soapenv:Body>]

cHttpSend += [</soapenv:Envelope>]

oHttp:Open( 'POST', cURL, .F. )

oHttp:SetRequestHeader( "Content-Type","application/xml")

oHttp:SetRequestHeader( "Accept","/")

oHttp:SetRequestHeader( "Authorization", "Basic "+hb_base64Encode(cCred))

oHttp:Send( cHttpSend )

Sysrefresh()

IF oHttp:status=200

cWinResp := oHttp:ResponseBody

ENDIF

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Soap Web Service - timeout request
Posted: Tue Jan 09, 2024 06:34 AM
Dear Darrell,

Please try this:

oHttp:Open( 'POST', cURL, .F. )
oHttp:SetRequestHeader( "Content-Type","application/xml")
oHttp:SetRequestHeader( "Accept","*/*")
oHttp:SetRequestHeader( "Authorization", "Basic "+hb_base64Encode(cCred))
oHttp:Send( cHttpSend )
oHttp:WaitForResponse( nSecs )
Sysrefresh()
IF oHttp:status=200
cWinResp := oHttp:ResponseBody
ENDIF
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Soap Web Service - timeout request
Posted: Tue Jan 09, 2024 12:47 PM

Hi Antonio,

Thank you. Question, if I set nSecs = 5 and responses comes back faster, will it still wait 5 seconds or process immediately?

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Soap Web Service - timeout request
Posted: Tue Jan 09, 2024 04:36 PM
cdmmaui wrote:Hi Antonio,
Thank you. Question, if I set nSecs = 5 and responses comes back faster, will it still wait 5 seconds or process immediately?
Does not wait.
Processes immediately.

Also for additional information:
httprequest method
SetTimeOuts( nResolveTimeOut, nConnectTimeOut, nSendTimeOut, nReceiveTimeOut)
All times in milli-seconds
Regards



G. N. Rao.

Hyderabad, India
Posts: 211
Joined: Wed Jul 16, 2008 12:59 PM
Re: Soap Web Service - timeout request
Posted: Thu Jan 11, 2024 06:50 PM
Darrell

intenta con 'MSXML2.ServerXMLHTTP' que tiene el metodo setTimeouts(lResolve, lConnect, lSend, lReceive)

'MSXML2.XMLHTTP' es distinto de 'MSXML2.ServerXMLHTTP'

Yo lo uso asi
Code (fw): Select all Collapse
oHttp := CreateObject( 'MSXML2.ServerXMLHTTP' )
oHttp:setTimeouts(  5 * 1000,   5 * 1000,  30 * 1000,  30 * 1000) //V1.1 ok
Atentamente

Rolando
Cochabamba - Bolivia

Continue the discussion