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
Soap Web Service - timeout request
- Antonio Linares
- Site Admin
- Posts: 42259
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Soap Web Service - timeout request
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
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
- cdmmaui
- Posts: 693
- Joined: Fri Oct 28, 2005 9:53 am
- Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong
- Contact:
Re: Soap Web Service - timeout request
Hi Antonio,
Thank you. Question, if I set nSecs = 5 and responses comes back faster, will it still wait 5 seconds or process immediately?
Thank you. Question, if I set nSecs = 5 and responses comes back faster, will it still wait 5 seconds or process immediately?
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: Soap Web Service - timeout request
Does not wait.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?
Processes immediately.
Also for additional information:
httprequest method
SetTimeOuts( nResolveTimeOut, nConnectTimeOut, nSendTimeOut, nReceiveTimeOut)
All times in milli-seconds
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: Soap Web Service - timeout request
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
Atentamente
Rolando
Cochabamba - Bolivia
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: Select all | Expand
oHttp := CreateObject( 'MSXML2.ServerXMLHTTP' )
oHttp:setTimeouts( 5 * 1000, 5 * 1000, 30 * 1000, 30 * 1000) //V1.1 ok
Rolando
Cochabamba - Bolivia