how to get the reference of struct soap inherited in C++ Proxy/Service class

791 views Asked by At

Currently I convert sample code in gsoap_distribution/samples/magic into C++ client code using soapProxy .cpp and C++ server code using soapService.cpp, which are generated by "soapcpp2 -i magic.h".

I have found problems when converting some functions that require soap reference as follows: soap_new_matrix(&soap, -1); soap_print_fault_location(&soap, stderr);

In my understading, Service/Proxy Classes (generated by "soapcpp2 -i" options) inherit the struct soap. Is there some way to get the reference to struct soap from C++ Proxy/Service class object?

Thanks for your reading.

1

There are 1 answers

0
Dr. Alex RE On

Because the proxy and service classes are inherited from the soap context class with option -i for soapcpp2, you can simply pass a pointer to your proxy or service objects to these functions. For example:

#include "soapmagicProxy.h" // generated by soapcpp2 -i magic.h
#include "magic.nsmap"      // XML namespace mapping table

magicProxy service("http://www.cs.fsu.edu/~engelen/magicserver.cgi");
matrix *matrix = soap_new_matrix(&service);
service.magic(7, matrix);
...
service.destroy();