user2140360
user2140360

Reputation: 11

Delphi 7 Web-service call and Access Violation

I have a problem with my Delphi 7 (build 8.1) application accessing a .NET SOAP web-service. Mostly it works fine but sometimes we receive an access violation. I believe (but am not 100% sure) that the error only has been seen when the user is the first to access the web-service within a “couple of hours” – e.g. I can call it hundreds of times in a loop without any problems.

I’ve disabled DEP (Data Execution Prevention) on every computer involved and I’ve also tried the updated WSDL importer from this download: http://cc.embarcadero.com/Item/24535. (I have however not been able to follow the readme file concerning the runtime files so maybe that’s my actual problem?)

Does anybody know how to solve this problem?

Upvotes: 0

Views: 3061

Answers (2)

pedrucaperes
pedrucaperes

Reputation: 1

I went through a similar problem, and I suggest that you include with your application rather the exception in the DEP (Data Execution Prevention), so it does not block the application. Still, in my case, there was the problem of the WebService take to return the answer with this application had AccessViolation. I had to add the "Application.ProcessMessages" function in your code after calling the WebService.

Upvotes: 0

Chris Thornton
Chris Thornton

Reputation: 15817

See my answer to this question How do I get the SOAP response when there was an exception? Actually, I have two answers there, but the one of interest is the RIO OnAfterExecute handler. There you can log your SOAP responses to a file, and you can see what's happening. I expect that after hours of inactivity, the server may be giving an empty response or is timing out. If the SOAP response XML comes back empty, and you try to treat the response as a SOAP object, it'll be nil and you'll blow up with an A/V for sure. So this way, you get to inspect the raw TEXT coming back, and react accordingly. And you can actually build defensive code in here. For example, if the response is empty, you could swap in some other XML that represents a SOAP fault exception. Now your SOAP handler will know what to do.

Upvotes: 2

Related Questions