Gsoap
The gSOAP toolkit simplifies the development and deployment of SOAP/XML Web Services and client applications in C and C++. The gSOAP RPC compiler does all the difficult work for you. It generates the necessary C and C++ source codes to seamlessly glue your C/C++ applications to the SOAP/XML Web Services stack. With the compiler you can enable your (existing) C and/or C++ applications to “talk SOAP”!.
gSOAP is not just a class library. The gSOAP RPC compiler produces routines to encode native and user-defined C/C++ types in XML. To make things even easier, gSOAP provides memory management with garbage collection so (XML-decoded) data can be cleaned up without a hassle.
Calling WCF Services from a Linux C++ Client Using gSOAP
Step 1: Build a server Web service by WCF
First, you need to make a server webservice by c#. Please follow this tutorial http://www.youtube.com/watch?v=GzN1vHWlJjA
When you finished to created a server. We will get link: http://www.myserver.com/myWCFservice.svc
Step 2: Download the gSOAP tar file. The website is here.
Step 3: Generate the WSDL header file.
1 wsdl2h -o mywcfheader.h http://myserver.com/myWCFService.svc?wsdl
Step 4: Generate the stub files by executing the gSOAP compiler
soapcpp2 -I “/lib/gSOAP/gsoap-2.7/gsoap/” mywcfheader.h
Step 5: Create the client
123456789101112131415161718192021222324252627282930 #include “BasicHttpBinding_IMyService.nsmap”using namespace std;int main(){// This will be the name of the service// class in the proxy header file from aboveBasicHttpBinding_IMyService s;// This is the request and response that// the service you are trying to call takes.// Again you can find the types in the class// used in the C++ proxy header_ns1__GetCount req;_ns1__GetCountResponse resp;string is(”Hello There America”);req.inputString = &is;int err = s.__ns1__GetCount(&req, &resp);if (SOAP_OK == err)cout << “Service Returned: ” << *resp.GetCountResult << endl;elsecout << “Error: ” << err << endl;return 0;}
Step 6: Compile the client
1 g++ -I "/lib/gSOAP/gsoap-2.7/gsoap" myclient.cpp soapC.cpp soapClient.cpp /lib/gSOAP/gsoap-2.7/gsoap/stdsoap2.cpp
Reference: http://www.cs.fsu.edu/~engelen/soap.html