问题
I using gSOAP
for web services, but i have a problem i must
compile 2 web services into one executable file, and some
functions have same names instead of argument for using
other prefix for function names.
Compilation Error:
X.o: In function `soap_get_string(soap*, char**, char const*, char const*)':
X.cpp:8669: multiple definition of `soap_get_string(soap*, char**, char const*, char const*)'
Y.o:Y.cpp:4763: first defined here
In Makefile:
wsdl2h -qlpr X.wsdl
wsdl2h Y.wsdl Y.xsd
soapcpp2 -qlpr -plpr -plprws $(GSOAP_IMPORT) -i -C X.h
soapcpp2 -psiwcprws $(GSOAP_IMPORT) -i -C Y.h
Have anyone idea how to solve this?
回答1:
19.34 How to Combine Multiple Client and Server Implementations into one Executable The wsdl2h tool can be used to import multiple WSDLs and schemas at once. The service definitions are combined in one header file to be parsed by soapcpp2. It is important to assign namespace prefixes to namespace URIs using the typemap.dat file. Otherwise, wsdl2h will assign namespace prefixes ns1, ns2, and so on to the service operations and schema types. Thus, any change to a WSDL or schema may result in a new prefix assignment. For more details, please see Section 8.2. Another approach to combine multiple client and service applications into one executable is by using C++ namespaces to structurally separate the definitions or by creating C libraries for the client/server objects as explained in subsequent sections. This is automated with wsdl2h option -q. Both approaches are demonstrated by example in the gSOAP distribution, the samples/link (C only) and samples/link++ (C++ with C++ namespaces) examples.
来源:https://stackoverflow.com/questions/8669377/how-to-compile-multiple-gsoap-client-webservices-into-one-executable