Reputation: 743
I am writing a simple cmd client to try to consume the WCF web service i developed in order to test how to connect to the Web service using unmanaged C++.
I have been following this tutorial http://www.blinnov.com/en/2008/01/22/wcf-service-unmanaged-client/ step by step but still not managed to consume the service successfully.
#include "BasicHttpBinding_USCOREIService1.nsmap"
#include "soapBasicHttpBinding_USCOREIService1Proxy.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char **argv)
{
BasicHttpBinding_USCOREIService1Proxy myProxy;
static const char* const endPoint = "http://localhost:50181/Service1.svc";
myProxy.soap_endpoint = endPoint;
_ns1__GetData param;
_ns1__GetDataResponse response;
param.fileName = &std::string("house.ifc");
if ( myProxy.GetData(¶m, &response) == SOAP_OK) {
cout << "Hello" << endl; //Succeeded
}
else {
myProxy.soap_stream_fault(std::cerr);
}
return 0;
}
it always gives me Error 415 fault: SOAP-ENV:Server[no subcode] "HTTP Error" Detail: HTTP/1.1 415 Unsupported Media Type I have been trying all the day to get it done but still nothing new. :(
Upvotes: 3
Views: 2633
Reputation: 3840
This is because gSOAP client and WCF service do not play nicely with SOAP 1.2. It will work if you use soapcpp2 with the "-1" switch to force SOAP 1.1.
I've tested it with gSOAP 2.8.4 on Ubuntu and it works.
Upvotes: 1
Reputation: 81
If your client will be installed in windows machine , the best way is to use a C++\CLI bridge that connect your client and the managed generated proxy, this is the only solution that works for all kind of wcf bindings (HTTP,TCP,MSMQ,...).
If you choose another librairy be sure that it can works perfectly only for HTTP binding.
Upvotes: 0