SOAP Fault handling with ERROR #5659: Property '%ZHSLIB.Audit.LogParticipant::Log' required

Primary tabs

Environment: Cache for Windows (x86-64) 2015.2.2 (Build 811U) Thu Mar 3 2016 12:55:48 EST [HealthShare Modules:Core:14.01.351 

When try the following to send back SOAP Fault, is the following correct way?

Set fault=##class(%SOAP.Fault).%New()
Set fault.faultcode=$$$FAULTServer
Set fault.faultstring="Processing Error"
Set fault.detail= "Error on server"
Do ..ReturnFault(fault)

Got the error 

ERROR #5659: Property '%ZHSLIB.Audit.LogParticipant::Log'
required
Stack:
  • $$^zGetErrorTrace+3 ^Ens.Util.Trace.1 +1
  • DO^zLogNoTrace+10^Ens.Util.Log.1 +1
  • DO^zLog+2^Ens.Util.Log.1 +1
  • DO^zLogStatus+4^Ens.Util.Log.1 +1
  • DO^zonOutsideErr+8 ^Ens.BusinessService.1 +1
  • DO^zReturnFault+5^EnsLib.SOAP.Service.1 +1

 

  • 0
  • 0
  • 325
  • 0
  • 1

Answers

Hello,

The code you included will return a SOAP fault to the client with the specified fault code and message. Since this is a Business Service, it will also log the fault to the Ensemble Event Log, along with the last error the process encountered (%objlasterror). This appears to be where this is where the error message is coming from.

Note that, again, since this is a Business Service, you can use the ReturnStatusFault() or ReturnMethodStatusFault() methods to create and return the SOAP fault instead of creating it manually. This should have the same behavior as your code, except that the fault code and message may be different. See the documentation here:

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

I'm not really sure that I answered your question. Can you give more information about the problem you are trying to solve?