I have some C++ headers files and I want to make their content available through a webservice using gSOAP. The headers are:
Shared.h,
A.h,
B.h;
both A.h and B.h include (import) the Shared.h file.
I generated two separate WSDL documents: A.wsdl and B.wsdl and then I built them into a single header file (final.h) using the wsdl2h tool.
wsdl2h -x -o A.wsdl B.wsdl -tC:\gsoap-2.8.22\gsoap\typemap.dat
After that, I compiled the final.h file with soapcpp2 in order to get the C++ stubs of two proxy services (corresponding to the two WSDL mentioned above).
soapcpp2 -j -S final.h -IC:\gsoap-2.8.22\gsoap\import;C:\gsoap-2.8.22\gsoap -x -2
soapcpp2 -j -C final.h -IC:\gsoap-2.8.22\gsoap\import;C:\gsoap-2.8.22\gsoap -x -2
Two different namespaces have been used, one for each WSDL, and everything works properly, but there is a problem. Since the Shared.h file is imported by both the A.h and B.h files, the data structures coded in it appear two times in final.h file (once with the A__ prefix associated to the A namespace and once with the B__ prefix associated with the B namespace).
How can I manage to avoid this problem and get them only once?
I tried to generate a third WSDL (Shared.wsdl), but I don't know how to import it into the A.wsdl and B.wsdl. Is it possible? How should I modify the A.h and B.h files in order to do so?
Should I follow another procedure?