Linker error when using gSOAP with two different wsdl files

I am writing a C ++ web service client using gSOAP for Linux using 2 separate wsdl files in one application. I managed to get everything to work with one wsdl file, and after reading the documentation, the process of using wsdl2h in both files went through:

    wsdl2h -o header.h wsdlfile1.wsdl wsdlfile2.wsdl

It worked fine, and then I did

    soapcpp2 -i -I/usr/share/gsoap/import/ header.h

Then I made all the usual namespace changes in the typemap.dat file as instructed. Now I have found that I have two .cpp and .h files of 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 instantiated each Proxy class and used it exactly the same as for one wsdl file. Then I compile with

    g++ -DWITH_OPENSSL main.cpp soapC.cpp soapService1Proxy.cpp soapService2Proxy.cpp -lgsoapssl++ -lssl

which returns an 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 "namespaces" refers to an array in .nsmap files (which in this case are the same for each wsdl). I have included only one of them, since the compiler complains about multiple definitions if I include both. I would really appreciate it if someone could tell me what I'm doing wrong here, as I tried to follow the recommendations and gSOAP docs as accurately as possible, but just can't solve this problem.

+3
source share
1 answer

I have never used SOAP, but I quickly looked through this user guide .

7.1.4 , -n -p soapcpp2 , 19.35 . , wsdl2h -q ++ . soapcpp2, -p, , , -n, namespaces ++, .

, , , , .

+2

All Articles