Return-Path: X-Original-To: apmail-cxf-users-archive@www.apache.org Delivered-To: apmail-cxf-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9DA4942F2 for ; Mon, 27 Jun 2011 20:41:41 +0000 (UTC) Received: (qmail 30731 invoked by uid 500); 27 Jun 2011 20:41:40 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 30643 invoked by uid 500); 27 Jun 2011 20:41:40 -0000 Mailing-List: contact users-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@cxf.apache.org Delivered-To: mailing list users@cxf.apache.org Received: (qmail 30628 invoked by uid 99); 27 Jun 2011 20:41:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2011 20:41:40 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sberyozkin@gmail.com designates 209.85.214.41 as permitted sender) Received: from [209.85.214.41] (HELO mail-bw0-f41.google.com) (209.85.214.41) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Jun 2011 20:41:35 +0000 Received: by bwd14 with SMTP id 14so2438677bwd.0 for ; Mon, 27 Jun 2011 13:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=UL7p334s2NZVe9e5keVusZJA/bo3J1nXYFGDg0ceYuA=; b=QYbyKv4bxyu/biozTM5PeV7HGDuB+xF/YFiYz9jDzuMOY0YVFJV5Ex77mpCcmMoFOu IPCl3KCyNX1S241ivFASwilpiom97Bg3U7wsiNcuACI4Ytv412gN68c3wzWzd81MeOVi nZZQTfhWzk3qKz1ogVM9/uj1tlLikysP+JaeY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=dbm/Z6ZbiXspNr9BWbtK9MfSjD1my/+GTteYE4hNOBg78vbxvaVLkUaVNyENtvSAXN Rp+i/YWmlqFChehh/P5gH73w9UbWiON4j/kz4I6yxp6UduE6S/YlfvyZCsKxTaar0IyF nS6XTqlGrwL1ffBCOI+ECeOG5apQoPIMGK1ss= MIME-Version: 1.0 Received: by 10.204.33.73 with SMTP id g9mr4837982bkd.171.1309207274112; Mon, 27 Jun 2011 13:41:14 -0700 (PDT) Received: by 10.204.25.208 with HTTP; Mon, 27 Jun 2011 13:41:14 -0700 (PDT) In-Reply-To: References: Date: Mon, 27 Jun 2011 21:41:14 +0100 Message-ID: Subject: Re: A question of choice From: Sergey Beryozkin To: users@cxf.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable HI Thanks for this info, I'll try to get back to later during the next few day= s Cheers, Sergey On Mon, Jun 27, 2011 at 3:53 PM, David Sills wro= te: > All: > > A question for designers out there who wish to opine on best practices > or advise me about an upcoming issue: we have an essentially RPC web > service being considered for conversion to a RESTful one. Apologies for > the length of the post before it even begins: > > The current SOAP web service, among other things, generates PDF reports > (using BIRT behind the scenes, although of course that could be swapped > out, which was the idea). A report can have arbitrarily many parameters > (and many have quite a few) that must be supplied. In addition, the > service performs a number of other functions are currently executed > within a single service call. For instance, the service may print the > generated document, keep it for later retrieval, or save it to a > database. It may retrieve a document from the database rather than > generating it. > > At the moment, what the service does is governed by a DocumentMetadata > object: > > public interface DocumentMetadata > { > =A0 =A0 =A0 =A0String getDesignFilename(); > =A0 =A0 =A0 =A0String getAssociatedCaseId(); > =A0 =A0 =A0 =A0String getDocumentItemPageId(); > =A0 =A0 =A0 =A0String getTitleToSaveAs(); > =A0 =A0 =A0 =A0boolean isKeepAfterProcessing(); > } > > This allows the client to specify the name of the report file to use in > generation, the case to which the document should be associated (a > one-to-many relationship), the database ID of the document, the title to > save the document as, and whether or not to keep it available. > > Another object (PrintJob) sent along details print parameters (printer > to use, number of copies, orientation, etc.). > > The service uses these to decide what to do: > > 1. If the designFilename is supplied, a report is generated. > 2. If the documentItemPageId is supplied, the report is retrieved from > the database. > 3. If the titleToSaveAs is supplied, the report is saved to the database > with the appropriate title in addition to the bytes of the report itself > (all saved documents require titles). > 4. If the report is saved to the database and the associatedCaseId is > supplied, a foreign-key reference to the case is inserted along with the > document record (documents may relate to cases or not [e.g., summaries > of daily activity relate to no specific case]). > 5. If the keepAfterProcessing is set to true, the document is saved and > information about how to retrieve it is returned to the client. > 6. If the print object is supplied (non-null), the document (however > obtained) is printed following the supplied parameters or sensible > defaults. > > What is returned to the client is a ProcessingOutcome object: > > public interface ProcessingOutcome > { > =A0 =A0 =A0 =A0boolean isReportCreationSuccessful(); > =A0 =A0 =A0 =A0String getDocumentId(); > =A0 =A0 =A0 =A0String getDocumentItemId(); > =A0 =A0 =A0 =A0String getDocumentItemPageId(); > =A0 =A0 =A0 =A0boolean isPrintingSuccessful(); > =A0 =A0 =A0 =A0String getUrl(); > =A0 =A0 =A0 =A0String getUnc(); > } > > Most of this is obvious: > > 1. Whether report creation was successful (false if the report was > retrieved from the database) > 2. The various database IDs associated with the document (don't even ask > - I didn't design the database, obviously) > 3. Whether or not printing was successful (false if it was not > requested) > 4. If the document was kept, a URL for retrieving it via HTTP and a UNC > reference for retrieving it via Windows Explorer et alia > > So now the questions: > > 1. Can or should this service be converted to REST? > 2. Can it be converted to REST as is, or should it be broken up into > smaller pieces (not sure the client would agree to that)? > 3. Can REST handle the amount of data a GET request would necessarily > have to include? > > Any ideas? Any tales of converting something like this and the ups and > downs you encountered? > > Thanks in advance! > > David Sills > > --=20 Sergey Beryozkin Application Integration Division of Talend http://sberyozkin.blogspot.com