Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

エラー処理ロジック

ApplicationError メソッドを使用すると、Web サービスがエラーを生成する可能性のあるすべての場所で SOAP フォルトを生成できます。例えば、クライアントの入力に一致する ID 値を持つ Contact が存在しない場合、現在の SOAPTutorial.SOAPService GetContact メソッドは “” を返して正常に終了します。このような場合、メソッドがエラーを適切に生成する必要があります。

SOAPTutorial.SOAPService GetContact を変更して、SOAP フォルトを生成するようにします。新しいメソッドは以下のとおりです。faultcodedetail の適切な値が ApplicationError に渡されることに注意してください。


Method GetContact(id As %String) As SOAPTutorial.Contact [ WebMethod ]
{
 if ##class(SOAPTutorial.Contact).%ExistsId(id) {
  quit ##class(SOAPTutorial.Contact).%OpenId(id)
 }
 else {
  do ..ApplicationError("ContactNotFound", 
                                 "Contact with id "_id_" could not be found!")
 }
}
FeedbackOpens in a new tab