gsoap uses pointers for optional parameters - you can send NULL if you don't want to provide a value, which will cause the element to not be sent. 0 is a valid integer value, so gsoap will still send an element containing that value in the request. Make it an int * and send NULL to leave that parameter out of the request.
--sam On Thu, Jul 17, 2008 at 7:22 AM, Jon Earle <[EMAIL PROTECTED]> wrote: > Hey folks, > > When building a web service by starting with a .h file (then compiling that > to a wsdl and skeletons via soapcpp2), is it possible to define some > parameters of the web services request as optional and have that state > reflected in the WSDL file? > > I tried adding a new integer parameter with a default value of 0 but saw > nothing other than the basic declaration in the WSDL and the skeletons. > Using soapUI to validate a request for that service with the new parameter > set to blank results in soapUI complaining that a value is required for that > parameter. > > //gsoap ns1 service method-style: addMyData rpc > //gsoap ns1 service method-encoding: addMyData > http://schemas.xmlsoap.org/soap/encoding/ > //gsoap ns1 service method-action: addMyData > http://localhost/Soap#addMyData > int ns1__addMyData( std::string objectID, ///< Request > parameter > int objectData, ///< Request parameter > std::string hexId, ///< Request parameter > int blocking = 0, ///< Request parameter (optional) > struct ns1__addMyDataResponse & ///< Response struct parameter > ); > > My attempt to make the parameter optional shown in red. > > Cheers! > Jon > >
