HydraExpress 4.6 |
HydraExpress C++ API Reference Guide |
|
Represents generic SOAP faults in the generated client proxy. More...
#include <rwsf/webservice/SoapFault.h>
Public Member Functions | |
SoapFaultException (const rwsf::SoapFault &fault) | |
rwsf::SoapFault | getFault () const |
rwsf::SoapFaultException represents generic SOAP faults in the proxy. If a fault is defined in the WSDL, a special class is generated for it; if it is not defined, an instance of rwsf::SoapFaultException is thrown from the client.
You may request the fault message as an std::string using what() . Alternatively, you can retrieve the SoapFault object using the getFault() method. The SoapFault object has methods for retrieving individual parts of the fault, such as the fault code and the fault detail. See rwsf::SoapFault for more information.
For an example on how generic and specific faults are caught, run the Fault example in your installdir\examples\webservices\Fault
directory.
The following code shows how a generated client implementation catches a rwsf::SoapFaultException in its invoke()
methods
. This excerpt is from the generated client for the DayofWeek example in your installdir\examples\webservices\DayofWeek
directory.
void invoke_getDayOfWeek(DayOfWeekBindingProxy& proxy) { RWDate date_in; RWCString dayOfWeek_ret; rwsf::CallInfo callInfo; try { dayOfWeek_ret = proxy.getDayOfWeek(callInfo, date_in); } catch(const rwsf::SoapFaultException& e) { std::cout << "Fault Code: " << e.getFault().getFaultcode().asString() << std::endl; std::cout << "Fault String: " << e.getFault().getFaultstring() << std::endl; } }
For more information on faults and exception handling, see the Web Service Development Guide.
rwsf::SoapFaultException::SoapFaultException | ( | const rwsf::SoapFault & | fault | ) |
Initializes an rwsf::SoapFaultException with the given SoapFault fault.
rwsf::SoapFault rwsf::SoapFaultException::getFault | ( | ) | const |
Returns the fault object as a SoapFault.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.