Question
· Mar 10, 2021

SOAP Error CONTENT-TYPE response text/html instead of text/xml

Hi all,

I have a very weird error when I'm calling to a SOAP Webservice as client.

I've create all objects to invoke to this SOAP using the add-in "Assistant SOAP" in Eclipse, it has created all objects (Response, Request, Business operation WS class, etc...).

When I call to this service it retuns the following error message:

ERROR #6243: HTTP request to SOAP WebService returned unexpected CONTENT-TYPE response: text/html.

However, If I call the same WS using SOAP UI or Postman, the header of response has the content-type "text/xml", as expected.

What is wrong? How I can check what is the header that is using in my response? Is not possible to debug to check that. May I need to insert any parameter manually in the class generated?

Best regards,
Kurro Lopez

Product version: HealthShare 2017.2
$ZV: Cache for Windows (x86-64) 2017.2.1 (Build 801_3U) Thu Apr 12 2018 10:02:23 EDT
Discussion (4)2
Log in or sign up to continue

Hi Kurro,

1) The best way to debug SOAP issues is to enable SOAP Logging on the client side.

On your Cache server, use Terminal to zn to the namespace from which the request originates and type:

NAMESPACE> set ^ISCSOAP("LogFile")="C:\temp\SOAP.log"

NAMESPACE> set ^ISCSOAP("Log")="ios"

and then retry your GET/POST. You should see messages in the file above.

To turn off logging, type:

NAMESPACE> set ^ISCSOAP("Log")=""

2) If you try this you will likely see the same error in the SOAP log. So the most likely issue is the ContentType property of your HttpRequest object.

In your Business Operation, your probably have code like this somewhere:

Set tHttpRequest = ##class(%Net.HttpRequest).%New()

Set tHttpRequest.ContentType = "text/xml" // is this property set?

Here is the message from the class on its default behavior:

Sets/gets the 'Content-Type:' entity header field in the HTTP request. If it
/// is not specified and there is an <PROPERTY>EntityBody</PROPERTY> then it default
/// to 'text/html'.<p>

...

Property ContentType As %String [ Calculated ];
 

So if you used HttpRequest.EntityBody for your payload, you probably need to set ContentType explicitly.

I hope this helps.

Thanks for your tip, using LogFile I've found what is the error.

The problem was that the configuration of the URL

but it works if "Web Service URL" has the full path.

I have other WS Clients and they are working with the Client Class in "Web Service Client Class" field

I think if the WS is like "http://myserver.com/path/service.asmx" it should be separated in both fields. However, if it is a Java WS (it hasn't class file) it sould be in URL field.

I'll bear in mind for future implementations.

Thanks for all your help.

Kurro