Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 72615 invoked from network); 14 Mar 2005 14:48:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 14 Mar 2005 14:48:53 -0000 Received: (qmail 30232 invoked by uid 500); 14 Mar 2005 14:48:51 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 30161 invoked by uid 500); 14 Mar 2005 14:48:51 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 30148 invoked by uid 99); 14 Mar 2005 14:48:51 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from 10.21.96-84.rev.gaoland.net (HELO mail.anyware-tech.com) (84.96.21.10) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 14 Mar 2005 06:48:49 -0800 Received: from localhost (localhost [127.0.0.1]) by mail.anyware-tech.com (Postfix) with ESMTP id 251AC1BAE3 for ; Mon, 14 Mar 2005 15:37:50 +0100 (CET) Received: from mail.anyware-tech.com ([127.0.0.1]) by localhost (trinity [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07488-09 for ; Mon, 14 Mar 2005 15:37:48 +0100 (CET) Received: from [10.0.0.27] (poukram.anyware [10.0.0.27]) by mail.anyware-tech.com (Postfix) with ESMTP id 8D7781BADF for ; Mon, 14 Mar 2005 15:37:48 +0100 (CET) Message-ID: <4235A44C.6090009@apache.org> Date: Mon, 14 Mar 2005 15:48:44 +0100 From: Sylvain Wallez Organization: Anyware Technologies User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: [cForms] Errors coming from service layer References: <423595CF.6070407@gmx.net> <4235999B.1010703@gmail.com> <42359CD3.1020209@apache.org> In-Reply-To: <42359CD3.1020209@apache.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at anyware-tech.com X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Reinhard Poetz wrote: > Vilya Harvey wrote: > >> Reinhard P�tz wrote: >> >>> >>> Imagine following scenario: You have a service layer that is exposed >>> as web services. cForms already does as much validation as possible >>> but some complex checks can only be performed by the backend. >>> >>> If I call a webservice (via Axis client) this webservice can return >>> errors (how this is done hasn't been defined yet). >>> >>> Are there any best practices or experiences how to map errors coming >>> from the service or domain layer to cForms widgets? (The error has >>> to appear at widget level.) >> >> >> >> In your flowscript, you can create your own ValidationError object >> and explicitly set that on the apppropriate widget. >> >> What we did was to define our own type of exception which included >> information about all validation errors that were found, then wrote a >> simple(-ish) flowscript function which handled looking up the >> relevant widgets, creating the error objects and setting them into >> the widgets. > > > Thank you! > > This means that the service layer is aware of which widgets exist? I'm > not sure if I (and especially my customer) likes this bi-directional > dependency... Nono! Your validation code has to catch the exception and translate it into a validation error. This means you can have "regular" validation errors (i.e. the backend could be reached but detected invalid data) and communication-level errors, e.g. "could not validate data, try again later". Sylvain -- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }