2

I'm developing a Qt C++ program which must send data to a web-service. I have used gsoap (v2.8.111) to generate the data binding source code this way:

wsdl2h -v -c++ -t ./typemap.dat -o binding/DonaldDuck.h ./DonaldDuck.wsdl 
wsdl2h -v -c++ -t ./typemap.dat -o binding/MickeyMouse.h ./MickeyMouse.wsdl 
wsdl2h -v -c++ -t ./typemap.dat -o binding/DaisyDuck.h ./DaisyDuck.wsdl 
wsdl2h -v -c++ -t ./typemap.dat -o binding/ScroogeMcDuck.h ./ScroogeMcDuck.wsdl 

soapcpp2 -C -c++ -j -qDonaldDuck -dbinding binding/DonaldDuck.h 
soapcpp2 -C -c++ -j -qMikeyMouse -dbinding binding/MickeyMouse.h 
soapcpp2 -C -c++ -j -qDaisyDuck -dbinding binding/DaisyDuck.h 
soapcpp2 -C -c++ -j -qScroogeMcDuck -dbinding binding/ScroogeMcDuck.h 

wsdl2h -c++ -g -t ./typemap.dat -o ./binding/Common.h *.wsdl
soapcpp2  -C -c++ -r -n -i -L -j -dbinding  ./binding/Common.h

If I use the typemap.dat configured for use of STL types I can successfully build and run the program. But because I'm developing with Qt I would like to use Qt types (specially QString and QDateTime), so I changed the typemap.dat file as explained here https://www.genivia.com/doc/databinding/html/index.html. With the new typemap.dat The generation using the same commands listed above was successful but during build a lot of multiple definitions are unexpectedly signaled.

I can't understand why this problem occurs, can anyone help me?

I am available to provide other information if needed.

  • 1
    The documentation does not suggest to run wsdl2h and soapcpp2 multiple times. That obviously produces code that has significant overlap. This overlap causes link errors. Can't you not just convert all the WSDL files together with one call to wsdl2h? Try inputting all WSDL files as the arguments to wsdl2h. Then run soapcpp2 just once. – Dr. Alex RE Mar 04 '21 at 15:41
  • Thanks for your comment. Making a single call for all wsdls is actually the first thing I tried, but I don't know why it didn't create the methods for the various endpoints. After reading the documentation, studying the command line switches and reading all the posts I found, the only working solution is the one I described. Among other things, with the same generation sequence, if I don't customize the typemap.dat and use the STL types there is no linking problem. Instead, they occur when I customize the typemap.dat to use QT types. – Emanuele Merlo Mar 05 '21 at 10:29
  • You could try wsdl2h option -Nname to see if that helps. By putting the WSDLs together on the same command line, it assumes that the WSDLs use different namespaces for the WSDL operations and schemas (best practice). If the WSDLs clash (same target namespaces), then there is likely an issue, likewise trying to compile multiple C++ projects that use the same C++ namespace is not going to end well. – Dr. Alex RE Mar 05 '21 at 22:07

0 Answers0