08 Nov 2020 21:45
With Object ::oServerWS
nResolve = 5 * 1000
nConnect = 5 * 1000
nSend = 15 * 1000
nReceive = 15 * 1000
cSOAPAction := "http://tempuri/RevertePagamentoLoteOP"
:SetTimeouts( nResolve, nConnect, nSend, nReceive )
:Open( "POST", ::cUrlWS, .F. )
:setRequestHeader( "SOAPAction", cSOAPAction )
:SetRequestHeader( "Content-Type", 'text/xml; charset="utf-8"' )
:SetRequestHeader( "Content-Length", hb_NtoS( hb_BLen( cXMLSoap ) ) )
:Send( ::oXMLDoc:xml )
Do While :readyState != 4
hwg_DoEvents()
:WaitForResponse( 500 )
Enddo
::cResponseText := :responseText
End
09 Nov 2020 07:46
09 Nov 2020 09:56
oServer:Send( ::cXmlSoap )
oServer:WaitForResponse( ::nSoapTimeOut )
cRetorno := oServer:ResponseBody()
setTimeouts (long resolveTimeout, long connectTimeout, long sendTimeout, long receiveTimeout)
09 Nov 2020 10:01
And the point is that OP wants a 15-seconds timeout. Due to your code, operation may exceed 15 seconds. This is not an asynchronous request
...
you are right. I changed to SYNCHRONOUS, which is what the OP wants and changed the send/receive timeouts to 15 secs
09 Nov 2020 10:06
JoséQuintas escreveu::WaitForResponse( n ) define o tempo de espera.
:Send( ::oXMLDoc:xml )
Do While :readyState != 4
hwg_DoEvents()
:WaitForResponse( 500 )
Enddo
09 Nov 2020 10:09
09 Nov 2020 10:11
//setTimeouts( long resolveTimeout, long connectTimeout, long sendTimeout, long receiveTimeout )
//oServer:SetTimeOuts( ::nSoapTimeOut, ::nSoapTimeOut, ::nSoapTimeOut, ::nSoapTimeOut )
oServer:Open( "POST", ::cSoapURL, .F. )
oServer:SetRequestHeader( "Content-Type", "application/soap+xml; charset=utf-8" )
oServer:Send( ::cXmlSoap )
oServer:WaitForResponse( ::nSoapTimeOut )
09 Nov 2020 10:11
09 Nov 2020 10:13
09 Nov 2020 10:15
asimoes escreveu:Quando o serviço está fora o send() espera até 2 min. para responder o WaitForResponse ignora isso
09 Nov 2020 10:18
09 Nov 2020 10:32
09 Nov 2020 10:41
//setTimeouts( long resolveTimeout, long connectTimeout, long sendTimeout, long receiveTimeout )
oServer:SetTimeOuts( ::nSoapTimeOut, ::nSoapTimeOut, ::nSoapTimeOut, ::nSoapTimeOut )
oServer:Open( "POST", ::cSoapURL, .F. )
oServer:Send( ::cXmlSoap )
oServer:WaitForResponse( ::nSoapTimeOut )
09 Nov 2020 10:50
09 Nov 2020 11:08