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 3A33C9337 for ; Thu, 29 Mar 2012 20:56:30 +0000 (UTC) Received: (qmail 32877 invoked by uid 500); 29 Mar 2012 20:56:29 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 32808 invoked by uid 500); 29 Mar 2012 20:56:29 -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 32799 invoked by uid 99); 29 Mar 2012 20:56:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Mar 2012 20:56:29 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [64.85.173.253] (HELO server.dankulp.com) (64.85.173.253) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Mar 2012 20:56:23 +0000 Received: by server.dankulp.com (Postfix, from userid 5000) id 99532182A7D; Thu, 29 Mar 2012 16:56:02 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on server.dankulp.com X-Spam-Level: X-Msg-File: /tmp/mailfilter-users@cxf.apache.org.wvF1u9RyMH Received: from dilbert.dankulp.com (c-24-91-72-253.hsd1.ma.comcast.net [24.91.72.253]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.dankulp.com (Postfix) with ESMTPSA id 6DC86182A7D; Thu, 29 Mar 2012 16:56:01 -0400 (EDT) From: Daniel Kulp To: users@cxf.apache.org Cc: Jesse Klaasse Subject: Re: Generated Java client from WSDL: request omits required element Date: Thu, 29 Mar 2012 16:55:58 -0400 Message-ID: <2571999.rXgZMhNlx0@dilbert.dankulp.com> User-Agent: KMail/4.8.0 (Linux/3.2.2; KDE/4.8.1; x86_64; ; ) In-Reply-To: <2A999A47A42ED94185DCE3BE09C3938E1373FFE0@AURORA.nl.indicia.org> References: <2A999A47A42ED94185DCE3BE09C3938E1373FFE0@AURORA.nl.indicia.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-102.9 required=3.0 tests=ALL_TRUSTED,BAYES_00, SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.3.2 On Thursday, March 29, 2012 10:51:56 AM Jesse Klaasse wrote: > I have generated a Java client from an existing WSDL. Part of the WSDL > is: > > > > Which resulted in this piece of code: > > @XmlElement(name = "Patients", required = true) > > protected TableOfBapi1084Srch patients; > > As you probably already assume from the "TableOfBapi1084srch" name, > "Patients" is a container element which is reflected by an (Array)List > in Java. All is fine so far. > > However, when this list is empty, the "Patients" element does not occur > in the request (checked with Wireshark), and thus (since the "Patients" > element is required) the web service reponse is not as expected. > > To me, this feels as a bug, and, more important, I don't have any clues > how to fix this behavior. Any ideas/suggestions? This is more of a JAXB thing, but.... The required=true stuff is really just used for two things: 1) If generating a schema (java first cases), it marks it minOccurs=1 instead of 0. 2) To let YOU the developer know you need to put something there. JAXB, by default, will not really look at that at runtime. If data is there, it writes it, if not, it doesn't. The only thing you can really do is turn on schema-validation which will do a complete validation of the xml against the schema. -- Daniel Kulp dkulp@apache.org - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com