Jump to content
ertank

SOAP - How to read incoming data when content type text/html

Recommended Posts

Hello,

 

There is an application that consumes a SOAP web service. From time to time this web service is not stable and sending various html error messages instead of a valid response.

 

Using Delphi 10.4.2 I would like to read incoming html data and display this to the user. Currently, all we can display is "Received content of invalid Content-Type setting: text/html - SOAP expect "text/xml" error message.

 

I have searched the internet. Someone suggested to modify Soap.SOAPHTTPTrans.THTTPReqResp.CheckContentType and prevent it from raising an exception but this does not sound like a decent solution and might cause other troubles with other applications using SOAP. What I am after is a solution to be used just with this specific application of ours.

 

I wonder if there is an alternative solution that can be used.

 

Thanks & Regards,

Ertan

Share this post


Link to post

I would capture that content (on exception of course) and will try to parse it for content that describes the error and display it to the user.

But first I would try to collect all types of errors/html and create some kind of templates to make it easier for parser (from above) to get the right content.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×