Nicki Vallentgoed · Oct 11, 2022

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:

<operation name="query">
  <soap:operation soapAction=""/>
    <soap:body use="literal"/>
    <soap:body use="literal"/>
  <fault name="Exception">
    <soap:fault name="Exception" use="literal"/>

which is:

<xsd:complexType name="Exception">
        <xsd:element name="message" type="xsd:string" minOccurs="0"/>

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
0 87
Discussion (2)1
Log in or sign up to continue

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.