Return-Path: X-Original-To: apmail-camel-commits-archive@www.apache.org Delivered-To: apmail-camel-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2BB12D5AD for ; Fri, 14 Sep 2012 15:24:48 +0000 (UTC) Received: (qmail 52844 invoked by uid 500); 14 Sep 2012 15:24:48 -0000 Delivered-To: apmail-camel-commits-archive@camel.apache.org Received: (qmail 52806 invoked by uid 500); 14 Sep 2012 15:24:48 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 52797 invoked by uid 99); 14 Sep 2012 15:24:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Sep 2012 15:24:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Sep 2012 15:24:46 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id F2BED238896F; Fri, 14 Sep 2012 15:24:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1384818 - in /camel/branches/camel-2.10.x: ./ components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/TypeNameStrategy.java Date: Fri, 14 Sep 2012 15:24:03 -0000 To: commits@camel.apache.org From: davsclaus@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120914152403.F2BED238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davsclaus Date: Fri Sep 14 15:24:03 2012 New Revision: 1384818 URL: http://svn.apache.org/viewvc?rev=1384818&view=rev Log: CAMEL-5615: Fixed camel-soap may marshal invalid XML with no tag name in the body. Modified: camel/branches/camel-2.10.x/ (props changed) camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/TypeNameStrategy.java Propchange: camel/branches/camel-2.10.x/ ------------------------------------------------------------------------------ Merged /camel/trunk:r1384815 Propchange: camel/branches/camel-2.10.x/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/TypeNameStrategy.java URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/TypeNameStrategy.java?rev=1384818&r1=1384817&r2=1384818&view=diff ============================================================================== --- camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/TypeNameStrategy.java (original) +++ camel/branches/camel-2.10.x/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/name/TypeNameStrategy.java Fri Sep 14 15:24:03 2012 @@ -16,10 +16,13 @@ */ package org.apache.camel.dataformat.soap.name; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchema; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; +import org.apache.camel.util.ObjectHelper; + /** * Strategy to determine the marshalled element name by looking at the * annotations of the class to be marshalled @@ -42,7 +45,15 @@ public class TypeNameStrategy implements nameSpace = xmlSchema.namespace(); } } - return new QName(nameSpace, xmlType.name()); + // prefer name from the XmlType, and fallback to XmlRootElement + String localName = xmlType.name(); + if (ObjectHelper.isEmpty(localName)) { + XmlRootElement root = type.getAnnotation(XmlRootElement.class); + if (root != null) { + localName = root.name(); + } + } + return new QName(nameSpace, localName); } public Class findExceptionForFaultName(QName faultName) {