Reputation: 21351
I am writing a C++ web service client using gSOAP on linux using 2 separate wsdl files in the same application. I have managed to get things working with just one wsdl file, and after reading documentation, went through the process of using wsdl2h on both files:
wsdl2h -o header.h wsdlfile1.wsdl wsdlfile2.wsdl
This worked fine and so I then did
soapcpp2 -i -I/usr/share/gsoap/import/ header.h
I then did all the usual namespace modifications in the typemap.dat as instructed. I now find that I have two .cpp and .h files of the type soapService1Proxy.cpp/h and soapService2Proxy.cpp/h. This is not quite what I expected, but regardless, I included both headers in my main function and created instances of each Proxy class and used in exactly the same way as I did for with just one wsdl file. I then compile with
g++ -DWITH_OPENSSL main.cpp soapC.cpp soapService1Proxy.cpp soapService2Proxy.cpp -lgsoapssl++ -lssl
which returns the error
/tmp/ccHNDAM4.o:(.data+0x0): multiple definition of `namespaces'
/tmp/ccLJIHwV.o:(.data+0x0): first defined here
collect2: ld returned 1 exit status
I know that the 'namepaces' refers to the array in the .nsmap files (which in this case are identical for each wsdl). I have included only one of these as the compiler complains of multiple definition if I include both. I really would appreciate it if anyone could tell me what I am doing wrong here as I have tried to follow the guidelines and gSOAP docs as faithfully as possible but simply cannot resolve this problem.
Upvotes: 5
Views: 4717
Reputation: 13421
I've never used SOAP but I had a quick look at this user guide.
The last paragraph in section 7.1.4 says that the -n
and -p
options to soapcpp2
help to resolve link conflicts. The link there to section 19.35 provides more information. It appears you have to run wsdl2h
on each file separately using the -q
option to provide a C++ namespace for each one. When you then run soapcpp2
it will automatically apply -p
and all you have to do is supply -n
to have the namespaces
array prefixed with your C++ namespace name followed by an underscore.
I haven't tried any of this but hopefully that will be enough to get you going again.
Upvotes: 3