How to get SOAP response when an exception occurs?

I accessed a third-party web service and returned an ESOAPHTTPException with a message in this format:

Cryptic message here - URL: http: // webserviceurl - SOAPAction: performWithArgList

The support staff for this web service has now requested a complete SOAP response. Usually I add an event handler to THTTPRIO.OnAfterExecute and just save the contents of the stream that I receive as a parameter.

But since Delphi throws an exception, this event handler is not executed. I understand that an exception can actually mean that the service failed in some catastrophic way, but there still needs to be some kind of answer (and not a timeout error).

Is there any other method I can use to grab the response before Delphi turns it into an exception?

+3
source share
3 answers

For an ERemotableException based exception, you want to look at the OnAfterExecute event, because it represents an error sent by the service ... but for ESOAPHTTPException (your case) you will want to handle the OnWinInetError event ( http://docwiki.embarcadero.com/VCL/en/SOAPHTTPTrans. THTTPReqResp.OnWinInetError ).

D2010 SOAP HTTP. , HTTP (, ). , , , , , , . : https://forums.embarcadero.com/message.jspa?messageID=304898&tstart=0

, " ", , , . , "" , . : https://forums.embarcadero.com/message.jspa?messageID=307048.

, OnWinInetError (LastError param). , , .

,

+6

, RIO .

OnAfterExecute

, . , , beign '', ( ) , .

+1

SOAPHTTPTrans THTTPReqResp.Check(), "if error". , , . , , . , - , . , , , , WireShark, Fiddler SoapUI.

IMO, functions such as Check () should have an additional parameter for CallerLocation, so that instead of calling this: Check (not assigned (request), false); you would call it: Check (not assigned (request), False, "THTTPReqResp.SendGet"); and Check will add CallerLocation to the error message and you will find out (a lot) about what is happening.

+1
source

Source: https://habr.com/ru/post/1792467/


All Articles