oracle has XML data parsing built into SQL.
select * from XMLTable( xmlnamespaces( 'http://www.w3.org/2003/05/soap-envelope' as "soap" ,'http://www.exchangenetwork.net/wsdl/register/1' as "ns1" ,'http://www.exchangenetwork.net/wsdl/register/1' as "ns2" ,'http://www.w3.org/2001/XMLSchema-instance' as "xsi" ), '/' passing XMLType('<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Body> <soap:Fault> <soap:Code> <soap:Value>soap:Receiver</soap:Value> </soap:Code> <soap:Reason> <soap:Text xml:lang="en">Fault occurred while processing.</soap:Text> </soap:Reason> <soap:Detail> <ns1:RegisterFault xmlns:ns1="http://www.exchangenetwork.net/wsdl/register/1"> <description xmlns:ns2="http://www.exchangenetwork.net/wsdl/register/1">The security token has expired.</description> <errorCode xsi:type="ns2:RegisterErrorCode" xmlns:ns2="http://www.exchangenetwork.net/wsdl/register/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">E_TokenExpired</errorCode> </ns1:RegisterFault> </soap:Detail> </soap:Fault> </soap:Body> </soap:Envelope>') COLUMNS code varchar2(100) PATH '/soap:Envelope/soap:Body/soap:Fault/soap:Code/soap:Value' ,error_desc varchar2(1000) PATH '/soap:Envelope/soap:Body/soap:Fault/soap:Detail/ns1:RegisterFault/description' ,errorCode varchar2(200) PATH '/soap:Envelope/soap:Body/soap:Fault/soap:Detail/ns1:RegisterFault/errorCode' );
I've just run into this.
If the webservice returns a fault, such as:
then the user gets presented with an unfriendly error message and there's no chance to output a more friendly one.
The response above is seen when testing the webservice, when run from the Form/Report page, we get something like:
Contact your application administrator.
When OK button is clicked everything is rolled back and we don't even get the fault XML.
It would be good if Apex could be optionally set to not give the unfriendly messages, so that we could code such a message ourselves.
Unless anybody has a workaround for this, I guess that I'll have to see if I can code this in PLSQL.