7

I am working in ubuntu, c++ code.

Using gsoap and wsdl2h -o header.h http://link1 http://link2 I've successfully succeeded to create .h, .cpp and .xml files. When I #include proxy1.h and #include proxy2.h and their nmsp files I receive the following error:

redefinition of "Namespace namespaces[]', previously defines here . 

How to solve this error? When I use: stdsoap2 -i -C -Iimport header.h can't I specify a different namespace for each url? I would like to mention that stdsoap.cpp is used when I compile the code. In stdsoap the namespace is called namespaces.

thx

marryy
  • 215
  • 1
  • 6
  • 13

2 Answers2

6

You must define WITH_NONAMESPACES when importing multiple webservices in a single client.

See How to Create Client/Server Libraries and soapcpp2 Options.

j4x
  • 3,595
  • 3
  • 33
  • 64
  • 2
    This is only if you are compiling stdsoap2.cpp file along with the generated code. If you are linking one of the gsoap libraries which were installed through Ubuntu repo. It wont solve your problem. One way it declare `struct Namespace *namespaces = NULL;' in global scope so that the linker can find it. – Sanjaya Wijeratne Nov 02 '19 at 18:01
0

Using gsoap 2.8.91 from the EPEL for RHEL 8 repo, I needed to "struct Namespace namespaces[] = {};" somewhere in the global space. You need to add this if you "#include <stdsoap2.h>". Since I was only using that include in one class, I added my global reference there.

Sanjaya's comment above should work for older versions of gsoap.

Chuck
  • 21