Call WCF Web Service from Rasberry PI (Raspbian)

Install Gsoap on Rasberry PI running Raspbian

sudo apt-get install gSoap

Check installed gSoap version (May 1,2014 version is 2.8.7)

Download the correspondent toolchain (class generator) from sourgeforce (Installed library and toolchain must have SAME VERSION!)

Open console as Administrator and go to the tools folder. For Example:

cd C:\gsoap\gsoap-2.8.7\gsoap\bin\win32

Then use toolchain to build file as follow for c++:

wsdl2h -o test.h
soapcpp2 -I"C:\gsoap\gsoap-2.8.7\gsoap\import" test.h

Import all generated files in your project (Exclude test.h , soapClientLib.cpp and soapServerLib.cpp)

Add stdsoap2.cpp and stdsoap2.h from toolchain directory.

Include *.nsmap and *Proxy.h in header.

Code Example

#include "Soap/BasicHttpBinding_USCOREIService1.nsmap"
#include "Soap/soapBasicHttpBinding_USCOREIService1Proxy.h"

int main(int argc, char *argv[])

BasicHttpBinding_USCOREIService1 s;
_ns1__GetData req;
_ns1__GetDataResponse resp;

int i = 29;
req.value = &i;

int err = s.__ns1__GetData(&req,&resp);

if (SOAP_OK == err)
cout << "WCF Response: " << *resp.GetDataResult << endl;
cout << "Error: " << err << endl;


Now you can see result in your console:

WCF Response: You entered: 29

If you receive Error 415 (Bad request) you have to change SOAP operation mode (WCF use an unusual charset for SOAP 1.1).

For removing soap 1.2 namespace from the your web-service client project you should to change strings

{"SOAP-ENV", "", "", NULL},
 {"SOAP-ENC", "", "", NULL},
 {"xsi", "", "*/XMLSchema-instance", NULL},
 {"xsd", "", "*/XMLSchema", NULL},


 {"SOAP-ENC", "", NULL, NULL},
 {"xsi", "", NULL, NULL},
 {"xsd", "", NULL, NULL},

in all your .nsmap file and *Proxy.cpp file.

One Comments

  • Huijeong,Ha

    19 gennaio 2015

    Hello, I want to using WCF service at Raspberry Pi.

    What’s mean ‘Add stdsoap2.cpp and stdsoap2.h from toolchain directory.’?


Lascia un commento