Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Kdsoap Error 299: content type not the expected type
ash_microsec last edited by
This is Qt related, but actually to do with the KDAB kdsoap library which provides a SOAP mechanism using Qt. There is little kdsoap resources online, so I'm posting here in case someone else in the Qt Development world has come across this problem.
This is also related to my previous post, albeit using a different kdsoap mechanism, http://developer.qt.nokia.com/forums/viewthread/11536/.
I am putting together a small Qt (4.7.4 shared) application that demonstrates using KDSoap (1.1.0 opensource) to provide a SOAP connection to a C# WCF service (all built using MSVS 2010).
The WCF service has a simple service contract:
public interface IMyServicePOC
bool MyMethod(string svalue);
Using MSVS 2010's WCF Test Client, the WCF service endpoints have been tested using IE and shown to work.
I have added a push button to my Qt application's GUI and attempted to use the example from the kdsoap opensource manual's "KD Soap 1 API Introduction" (page 3):
const QString endPoint = QLatin1String("http://www.27seconds.com/Holidays/US/Dates/USHolidayDates.asmx");
const QString messageNamespace = QLatin1String("http://www.27seconds.com/Holidays/US/Dates/");
KDSoapClientInterface client(endPoint, messageNamespace);
KDSoapMessage response = client.call(QLatin1String("GetValentinesDay"), message);
// get the entered value
QString value = ui.m_ledValue->text();
// create the SOAP client interface
const QString end_point = "http://localhost:8732/Design_Time_Addresses/ServicePOC/Service1/mex"; // this is proven to be correct
const QString msg_namespace = "IMyServicePOC"; // I don't really know what I should be setting this value to?!
KDSoapClientInterface client(end_point, msg_namespace);
client.setSoapVersion(KDSoapClientInterface::SOAP1_2); // see comment in post
// construct the method call's parameters
// perform the remote call
KDSoapMessage response_smsg = client.call("MyMethod", smsg, "application/soap+xml");
I get the following error message when I click the button and the code is executed:
Fault occurred: Fault code 299:
Error downloading http://localhost:8732/Design_Time_Addresses/ServicePOC/Service1/mex - server replied:
Cannot process the message because the content type 'application/soap+xml; charset=utf-8; action=application/soap+xml' was not the expected type 'application/soap+xml; charset=utf-8'.
Given my C# WCF Service Contract (above), what is the correct KDSoapClientInterface namespace parameter value?
What do I need to change to get rid of the above error message? I originally tried using the default SOAP version (KDSoapClientInterface::SOAP1_1), but that gave me a similar error message complaining about 'text/soap+xml'.
ash_microsec last edited by
After looking at other posts with the "kdsoap" tag, I'm hoping that the forum member David Faure at KDAB will be able to provide an answer to my problem.
dfaure last edited by
The soap action is not the mimetype, indeed. It is a string expected by the service in order to identify the action to execute. The best way to find it out is to look at the .wsdl file.
In fact the whole code could be generated from the .wsdl file, using kdwsdl2cpp. Can you send me the .wsdl file?
The issues with the soap version might be fixed in the most recent kdsoap, would like to try the code below and email me with the results?