Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 9257 invoked from network); 4 Dec 2009 00:28:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Dec 2009 00:28:45 -0000 Received: (qmail 41248 invoked by uid 500); 4 Dec 2009 00:28:42 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 41191 invoked by uid 500); 4 Dec 2009 00:28:42 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 41181 invoked by uid 99); 4 Dec 2009 00:28:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 00:28:42 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of musachy@gmail.com designates 209.85.160.48 as permitted sender) Received: from [209.85.160.48] (HELO mail-pw0-f48.google.com) (209.85.160.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Dec 2009 00:28:32 +0000 Received: by pwi6 with SMTP id 6so1841126pwi.27 for ; Thu, 03 Dec 2009 16:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=08rHtEMV31uPDSzubmel0qdkjSdDKwOYesyMcQncSlc=; b=BNqIoN032PZgj1auDGyyekTHN/Q66KiursMC8QYqmwUpQu9Ey5UTtczytImm1LWenD 4AyKlMSAXg3CnoThq2P637ULjKFzeLKt02JCmtLaqjP8Ug8cUVBFXZa0Bj5R7bH4diGt C6ABqaNYOd3d9TtIUdM4zlPQOIGPcizSq5/MU= 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=YLa3VurMp+hB3uOkJ1beRG1s2wSHprGqb0iJXudejNGBheBz3HVXYdbm5GFKwtfx9S 8hy0Pg8cYudAXSTvPfP+JtBD4UVPp16x01igWfgXtflz3n+2iJY3Wm+ob5J0HpVT9dcX k6E4YdoxsvPD45jVXLt4V6uKPfTAlzvFr8QNU= MIME-Version: 1.0 Received: by 10.115.103.9 with SMTP id f9mr3105879wam.112.1259886490730; Thu, 03 Dec 2009 16:28:10 -0800 (PST) In-Reply-To: <26635563.post@talk.nabble.com> References: <26635563.post@talk.nabble.com> Date: Thu, 3 Dec 2009 16:28:10 -0800 Message-ID: Subject: Re: Problem with Struts 2 JSON RPC using simple HTTP Post (not using DOJO) From: Musachy Barroso To: Struts Users Mailing List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org It seems like one of the fields of TransportAssignmentVO is a list, and what is coming from the JSON objects looks more like a map, can you set a break point on ClassCastException exceptions and tell us what the field is? or post the setter/getters of TransportAssignmentVO. musahcy On Thu, Dec 3, 2009 at 4:05 PM, Jeet08 wrote: > > I have developed a native client interface which calls struts2 JSON RPC u= sing > post method. I have set content type, content length as suggested in the > spec. The request body looks like as follows : > {"method": "uploadTxpAssignment","id": "txpUploadRequest", > "params":{"addressByDestAddrId":{"addrLine1":"test home","addrLine2":"7th > ave","addressId":2,"aptRoomNo":5,"city":"queens","phone":"435-577-4567","= state":"NY","zipCode":10183},"atDestTime":null,"callRcvdTime":"2009-11-26T0= 8:01:00","comments":"comments1","dateCreated":"2009-11-26T00:00:00","dateMo= dified":null,"user":{"dateCreated":null,"dateModified":null,"dob":"1956-09-= 18T00:00:00","firstName":"passfname","gender":"Male","lastName":"patient1ln= ame","mi":null,"ssn":null,"userId":10000}}} > > The struts.xml configurations are : > method=3D"smd"> > =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0true > =A0 =A0 =A0false > =A0 > =A0 > =A0 =A0 =A0true > =A0 =A0 =A0 =A0false > =A0 =A0 =A0 =A0 =A0 =A0 text/plain > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A01024 > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0false > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0UTF-8 > =A0 =A0 =A0 =A0 > =A0 =A0 > > The simple action code body : > public class UploadCallreportAction { > =A0 =A0 =A0 =A0private TransportAssignmentVO transport; > =A0 =A0 =A0 =A0/** > =A0 =A0 =A0 =A0 * @return the transport > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0public TransportAssignmentVO getTransport() { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return transport; > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0/** > =A0 =A0 =A0 =A0 * @param transport the transport to set > =A0 =A0 =A0 =A0 */ > =A0 =A0 =A0 =A0public void setTransport(TransportAssignmentVO transport) = { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0this.transport =3D transport; > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0public String smd() { > =A0 =A0 =A0 =A0return Action.SUCCESS; > =A0 =A0} > > =A0 =A0@SMDMethod > =A0 =A0public void uploadTxpAssignment(TransportAssignmentVO txpVO) { > =A0 =A0 =A0 =A0setTransport(txpVO); > =A0 =A0 =A0System.out.println("The Tansport assignment is for Run #:"+ > transport.getRunNumber()); > =A0 =A0 =A0} > } > > When I run the client the call reaches the server and returns me an > exception : > :35,013 ERROR [RPCError] java.util.HashMap cannot be cast to java.util.Li= st > java.lang.ClassCastException: java.util.HashMap cannot be cast to > java.util.List > =A0 =A0 =A0 =A0at org.apache.struts2.json.JSONInterceptor.invoke(JSONInte= rceptor.java:204) > =A0 =A0 =A0 =A0at > org.apache.struts2.json.JSONInterceptor.intercept(JSONInterceptor.java:13= 1) > =A0 =A0 =A0 =A0at > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvoc= ation.java:237) > =A0 =A0 =A0 =A0at > org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:= 52) > =A0 =A0 =A0 =A0at > org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:48= 8) > =A0 =A0 =A0 =A0at > org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.= java:395) > > I am also using Spring 2.5 and Hibernate JPA in the same app.... Not sure= if > there is any conflict.I have followed the simple rules to set up the JSON > RPC.However I am not able to resolve the problem. Please let me know if > anyone has a solution for this. > -- > View this message in context: http://old.nabble.com/Problem-with-Struts-2= -JSON-RPC-using-simple-HTTP-Post-%28not-using-DOJO%29-tp26635563p26635563.h= tml > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org