Nowadays it appears that few people are using C/C++ to do network programming. Microsoft has deprecated its SOAP toolkit. gSOAP of Genivia Inc. seems to be the only way to create C/C++ code from WSDL. Unfortunately, the C++ code that gSOAP generates has a lot of problems. But no one seems to care. I googled for solutions to some of these problems, but I found nothing.
1. The header file generated by wsdl2h can have syntax errors. For example, the class definition of a common class like xsd__base64Binary looks like this:
/// Built-in type "xs:base64Binary".
class xsd__base64Binary unsigned char *__ptr; int __size;
The curly brackets are missing. It turns out that the configuration file had it listed that way. wsdl2h does not care about that, and spits it out without complaints. The same thing happens to an enum definition:
/// Built-in type "xs:boolean".
enum xsd__boolean false_, true_ ;
The name of the enum type is then later used as a class name.
Obviously the code will not even build.
2. The C++ file generated by soapcpp2 incorrect merges two WSDLs into one.
Fortunately wsdl2h allows more than one WSDL. It is a rather common situation that one would need to access more than one SOAP service, and being able to generate code from multiple WSDL’s is quite critical.
But then soapcpp2 would merge them all into one. If you have ServiceA and ServiceB, you will get only ServiceA, with the members of ServiceB actually contained in ServiceA. The default endpoint URL is a concatination of the two service URLs in one:
endpoint = "http://serviceA http://serviceB";
Of course, calling the methods in these proxy classes would be problematic.
Although some of the big name companies like IBM are using gSOAP, but I don’t know how they can be using it as is, unless they are all coding in plain C, not C++.
So we have to go either all the way to a managed language such as Java or C#, or we have to stay with plain old C.