Custom SOAP fault
I am creating a soap service according to a wsdl that the client has already coded against.
In their operation they have a fault element Exception:
<operationname="query"><soap:operationsoapAction=""/><input><soap:bodyuse="literal"/></input><output><soap:bodyuse="literal"/></output><faultname="Exception"><soap:faultname="Exception"use="literal"/></fault></operation>which is:
<xsd:complexTypename="Exception"><xsd:sequence><xsd:elementname="message"type="xsd:string"minOccurs="0"/></xsd:sequence></xsd:complexType>I have tried creating a class called "Exception" extending %SOAP.Fault, adding a message property and then do a ReturnFault() but it just shows the standard soap fault.
How do I return a fault object as expected?
Product version: Ensemble 2018.1
$ZV: Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2018.1.7 (Build 721U) Fri Mar 18 2022 22:01:43 EDT
Discussion (2)0
Comments
You need to call ReturnFault method with your Fault object and pass the fault as an arg to this method.
Check the docs.
Answering incase someone has the same issue.
It does not support the <fault> element. That is, if you include a <fault> element within the <operation> element of the binding, the <fault> element is ignored.