This seems to be a generic problem with the approach gSOAP takes to
custom serializers. And may, in part, be due to a bug in soapcpp2.

If you're building a multi-client/server SOAP executable, custom
serializers should be specific to each client or server instance, since
each may have different requirements. As things stand, 2.7.17 appears to
insist that a custom serializer will be global, typically resulting in
linker errors.

When you use "soapcpp2 -qabc" (and/or "wsdl2h -qabc"), the generated
code for serializing data types is all defined within the namespace abc.
And all the types are defined as SOAP_TYPE_abc_xsd_<type> (rather than
SOAP_TYPE_xsd_<type>). But if you include a custom serializer, such as
custom/duration.c, for some reason, the prototypes generated for it in
abcH.h are placed in the global namespace, whilst all other generated
code is in namespace abc. E.g., from abcH.h:
...
}  // namespace
#ifndef SOAP_TYPE_abc_xsd__duration
#define SOAP_TYPE_abc_xsd__duration (37)
#endif
SOAP_FMAC1 void SOAP_FMAC2 soap_default_xsd__duration(struct soap*,
LONG64 *);
SOAP_FMAC1 int SOAP_FMAC2 soap_out_xsd__duration(struct soap*, const
char*, int, const LONG64 *, const char*);
SOAP_FMAC1 LONG64 * SOAP_FMAC2 soap_in_xsd__duration(struct soap*, const
char*, LONG64 *, const char*);
namespace abc {
...

(I suspect this may be a bug, since section 19.33 of the 2.7.17 UG
clearly states "When compiling this header file with the gSOAP soapcpp2
compiler, all type definitions, the (de)serializers for these types, and
the stub/skeleton codes will be placed in this namespace.")

The result is that all clients/servers have to share these global
routines, but their instantiations are actually client/server-specific
because they need to use the type that has been assigned - e.g.,
SOAP_TYPE_abc_xsd__duration. So they can't be global and shared.

What I believe needs to happen, in c++, which is what I care about, is
that all custom code be in the specified c++ namespace, which would be
consistent with soapcpp2's generated code for serializers when -qabc is
specified. In particular, the prototypes for soap_default_xsd__duration,
etc. in abcH.h should also be declared in namespace abc. I can then at
least see a way forward to having custom serializers in my
multi-client/server executable.

Or have I completely misunderstood this stuff?

Kevin.

Reply via email to