c++ - 如何将多个 gsoap 客户端 web 服务编译成一个可执行文件?

标签 c++ web-services gsoap

我将 gSOAP 用于网络服务,但我遇到了一个问题,我必须 将 2 个 Web 服务编译成一个可执行文件,以及一些 函数具有相同的名称而不是使用参数 函数名称的其他前缀。

编译错误:

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

在生成文件中:

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

有人知道如何解决这个问题吗?

最佳答案

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.

关于c++ - 如何将多个 gsoap 客户端 web 服务编译成一个可执行文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8669377/

相关文章:

java - 使用 JNI Java 类的 DLL

c++ - 线段相交平面扫描算法中状态结构的使用

xml - BPEL错误: [MessageVariableRequired] Cannot use non-message variable

wcf - 在 WCF Web 服务和 gSOAP 上使用压缩

c++ - 是在编译时还是运行时检查 "const member function"?

c++ - 如何使用 OpenMP 并行化此循环?

c# - 如何使用相对路径引用 WSDL 文件?

wcf - 为什么 WCF 服务使用接口(interface)作为服务契约而不是抽象类?

c++ - 错误 LNK2019 : unresolved external symbol _soap_ssl_init

c++ - 将 Gsoap Src 文件编译到我的项目中