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 8DEF57D5B for ; Fri, 9 Dec 2011 16:16:05 +0000 (UTC) Received: (qmail 97308 invoked by uid 500); 9 Dec 2011 16:16:04 -0000 Delivered-To: apmail-cxf-users-archive@cxf.apache.org Received: (qmail 97235 invoked by uid 500); 9 Dec 2011 16:16:04 -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 97227 invoked by uid 99); 9 Dec 2011 16:16:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 16:16:04 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sberyozkin@gmail.com designates 74.125.82.49 as permitted sender) Received: from [74.125.82.49] (HELO mail-ww0-f49.google.com) (74.125.82.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 16:15:57 +0000 Received: by wgbdt11 with SMTP id dt11so5393137wgb.6 for ; Fri, 09 Dec 2011 08:15:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=roSKKCohAHcLZ+2iqV1OXnJ23YWFm8dYJA9OuQVEGxA=; b=D8Oa9mlM2bxuq4iFEym5WRhbMQSyBtR0Vs9rRVUPPXyfCUU0Dln8K0n3tMuJWpcp8e we7AbdQU+OaRcYchQCy0briX5RW/9NJYerNj/t5SO/Q1cTIGEq3PJzXcATeFjkf+/Nl6 m0gDynmp+Rf1RuRyJBBnw24iVQfKoNxRak5bM= Received: by 10.227.199.78 with SMTP id er14mr7209968wbb.10.1323447337286; Fri, 09 Dec 2011 08:15:37 -0800 (PST) Received: from [192.168.2.3] ([89.100.138.187]) by mx.google.com with ESMTPS id p2sm222929wbh.22.2011.12.09.08.15.36 (version=SSLv3 cipher=OTHER); Fri, 09 Dec 2011 08:15:36 -0800 (PST) Message-ID: <4EE23427.2090302@gmail.com> Date: Fri, 09 Dec 2011 16:15:35 +0000 From: Sergey Beryozkin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11 MIME-Version: 1.0 To: users@cxf.apache.org Subject: Re: Long vs long... References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 09/12/11 11:10, Jeff Wang wrote: > I have a class with the ID as Long (I like to use null to indicate not > yet stored, as opposed to a magic-number that is defined as the > not-yet-stored number. However, when JAXB is done serialzing it, the > type comes out as "@xsi.type":"xs:long", which, when ClientProxyImpl > tries to deserialize, comes up with the error > java.lang.IllegalArgumentException: prefix xs is not bound to a > namespace. Is it a JSON sequence ? The error is side-effect of this xsi type which is probably not needed for this particular case; you'd need to set up a namespace map for JSONProvider if you prefer to keep 'xsi' & 'xs' > > There are also problems passing in JSON strings as {"user" : {'id' : > 5}} results in com.sun.org.apache.xerces.internal.dom.ElementNSImpl > cannot be cast to java.lang.Long. However, PathParams and QueryParams > assign properly to types of Long. How does the method signature look like and where is this exception originating from ? > > What are the best ways to address the serialization and > deserialization problem? I read about setting read and write xsi > boolean values in JSONProvider, How do I do that? (and if I set them > to false, what other affects could it have? set either 'writeXsiType' to false or 'readXsiType' to false on org.apache.cxf.jaxrs.provider.JSONProvider and register it in jaxrs:providers (on either side, assuming Spring is used) or say WebClient.create("someaddress", Collections.singletonList(provider)); Side-effect is that the consumer won;t be able to populate beans properly if you get subtypes of a given type serialized, but it is not the main JSON area I guess... Using Jackson is also an option Cheers, Sergey > > thanks > Jeff -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/ Blog: http://sberyozkin.blogspot.com