Trying to use gSoap with WCF and WSHttpBinding

1.3k Views Asked by At

I am attempting to use the gSoap library to talk to a WCF server with the WSHttpBinding. I seem to be running into a problem with the WS-Addressing plugin for gSoap. When I enable the WS-Addressing plugin, by using #import "wsa5.h" I can no longer compile. Now, there are unresolved symbols in soapC.cpp. The first error is in soap_getelement(soap*, int*). The error is SOAP_TYPE_wsa5_IsReferenceParameter. This is my first attempt with using gSoap. Any advice is appreciated.

gSoap Version 2.8.4

1

There are 1 best solutions below

3
On

What you can do is add the WSA part to your Typemap file, then in your wsdl2h command specify it with the -t parameter.

i.e:

wsdl2h -o target.h -t EditedTypemap.dat target.wsdl

You can just copy the standard Typemap.dat from your gSOAP directory and edit it so it looks like the following:

wsa = <http://schemas.xmlsoap.org/ws/2004/08/addressing>

SOAP_ENV__Header =\
#import "wsa.h"\n\
struct SOAP_ENV__Header\n\
{\n\
   mustUnderstand _wsa__MessageID    wsa__MessageID 0;\n\
   mustUnderstand _wsa__RelatesTo *  wsa__RelatesTo 0;\n\
   mustUnderstand _wsa__From *       wsa__From      0;\n\
   mustUnderstand _wsa__ReplyTo *    wsa__ReplyTo   0;\n\
   mustUnderstand _wsa__FaultTo *    wsa__FaultTo   0;\n\
   mustUnderstand _wsa__To           wsa__To        0;\n\
   mustUnderstand _wsa__Action       wsa__Action    0;\n\
};

Then rerun wsdl2h as I mentioned above. Hope this works for you! gSOAP is a great toolkit, just a little finnicky to get into.