[OpenSPP-project] First pass at gSOAP client for OpenSPP server
Status: Planning
Brought to you by:
deanwillis
From: Dean W. <dea...@so...> - 2011-08-12 03:08:14
|
In the interest of experimentation, I tried whacking together a very minimal client to do a GetDestGrps transaction, in C++ using gSOAP. I had no difficulties using the gSOAP tools with the WSDL and XSD files to generate stubs. I'll confess I'm not a great C++ coder. I think I last wrote commercial code in C++ in 1995, and that was before STL. It might have even been before templates ... so my code is a "brute force" experiment. Even the target string and URI are hard-coded for now. I am able to use the code to query for an existing destination group and retrieve cTime and mTime along with appropriate status codes. I haven't been able to retrieve the rant from the API. This may well be just weak C++ theory on my part. But the problem I'm having seems to be related to inheritance in the schema. It looks like our schema was designed to be able to return multiple record types in the same response. Each response record has a SoapType field that tells us what it really is. That, however, causes problems in gSOAP, as different records types have different sizes (making vectors work funny), and one has to jump through a couple of hoops to type-check and recast pointers at run-time. The spppQueryRequest produced by gSOAP returns a vector of BasicObjType. So, iteration across it is type-safed to the BasicObjType. But the rant is in the DestGrpType derived from BasicObjType, forcing one to cast the iterator to get the compiler to allow assignment. What I'm doing here compiles, but I get a null rant out of it (for a query that works with SoapUI). Anyhow, here's the code, if you want to play with it. The makefile presumes the mysoap.cpp file, the wsdl, and the xsd are all in the same directory. -- Dean Willis |