gSoap, c++, how to pass a soapStub declared argument in client application -
the project containing following excerpts client application using gsoap generated c bindings ( gsoap - www.cs.fsu.edu/~engelen/soap.html ) project builds fine, breaks on line in main function indicated below.
defined in project header file:
class soap_cmac _ns7__accounts { public: std::vector<std::string>accountnumber; /* required element of type xsd:string */ std::string *requestidtrackingforesb; /* optional attribute */ struct soap *soap; /* transient */ public: virtual int soap_type() const { return 23; } /* = unique id soap_type__ns7__accounts */ virtual void soap_default(struct soap*); virtual void soap_serialize(struct soap*) const; virtual int soap_put(struct soap*, const char*, const char*) const; virtual int soap_out(struct soap*, const char*, int, const char*) const; virtual void *soap_get(struct soap*, const char*, const char*); virtual void *soap_in(struct soap*, const char*, const char*); _ns7__accounts(): requestidtrackingforesb(null), soap(null) { _ns7__accounts::soap_default(null); } virtual ~_ns7__accounts() { } };
and defined in accompanying .cpp file:
int addressbyaccount_extws_bpelsoapproxy::accountsbpel(_ns7__accounts *ns7__accounts, _ns9__accountsresponse *ns9__accountsresponse);
in main() declare service readability:
addressbyaccount_extws_bpelsoapproxy service.
here main.cpp
#include <iostream> #include "soapaddressbyaccount_extws_bpelsoapproxy.h" #include "addressbyaccount_extws_bpelsoap.nsmap" #include <winsock2.h> using namespace std; struct soap *soap; int main() { addressbyaccount_extws_bpelsoapproxy service; _ns9__accountsresponse *presult = 0; _ns7__accounts *pinput = 0; //_ns7__account defined in .h excerpt above char account[] = "00000201"; //input value attempting pass web service //std::vector<std::string>accountnumber; defined in .h excerpt above, pinput->accountnumber.push_back(account); //breaks here - 0xc0000005 returned. if (service.accountsbpel(pinput, presult) == soap_ok) { cout << "soap ok!" << endl; ; } else service.soap_stream_fault(std::cerr); return 0; }
anybody have idea of doing wrong assigning string pinput ?
thanks
you dereferencing null pointers.
should work better with:
_ns9__accountsresponse result; _ns7__accounts input;
...
if (service.accountsbpel(&input, &result) == soap_ok)
Comments
Post a Comment