2011-12-29 73 views
4

我使用gSOAP爲Web服務,但我有一個問題,我必須 編譯2網絡服務爲一體的可執行文件,以及一些 函數具有相同的名稱,而不是論證了使用其他 前綴函數名。如何將多個gsoap客戶端webservices編譯成一個可執行文件?

編譯錯誤:

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 

在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 

有任何人知道如何解決這個問題?

回答

6

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.

+2

來源:http://www.cs.fsu.edu/~engelen/soapdoc2.html#tth_sEc19.34 – wimh 2012-01-31 11:55:19

相關問題