rwsf::SoapFaultExceptionrwsf::Exception
#include rwsf/webservice/SoapFault.h
rwsf::SoapFaultException represents generic SOAP faults in the proxy. If a fault is defined in the WSDL, a special class is generated for it; however, if it is not defined, an instance of rwsf::SoapFaultException is thrown from the client.
You may request the fault either by using the why() method from its base class rwsf::Exception, or by using this class' own getFault() method. The why() method returns the SOAP fault as string, while the getFault() method returns a rwsf::SoapFault object which allows you to access individual parts of the fault such as the fault code and fault string. See rwsf::SoapFault.
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) //1 { RWDate date_in; RWCString dayOfWeek_ret; rwsf::CallInfo callInfo; try { dayOfWeek_ret = proxy.getDayOfWeek(callInfo, date_in); } catch(const rwsf::SoapFaultException& e) { //2 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 Section 7.3.6, "Error Reporting and Faults," in the HydraExpress Web Service Development Guide.
SoapFaultException(const rwsf::SoapFault & fault);
Initializes a rwsf::FaultException with the message fault.
rwsf::SoapFault getFault() const;
Returns the SOAP fault.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.