Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 17914 invoked from network); 4 Dec 2009 00:35:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Dec 2009 00:35:21 -0000 Received: (qmail 51520 invoked by uid 500); 4 Dec 2009 00:35:18 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 51466 invoked by uid 500); 4 Dec 2009 00:35:18 -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 51456 invoked by uid 99); 4 Dec 2009 00:35:18 -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:35:18 +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:35:07 +0000 Received: by pwi6 with SMTP id 6so1846116pwi.27 for ; Thu, 03 Dec 2009 16:34:46 -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=haCqnQdZf0Pxvk8EAkFwFR29uu6NW/Al4vraEpPLqkg=; b=eMZ/Fh5EERzc7iv4EKPAEcAnLvKqp6Cx6Zvjq6GPfmucKLU5gv4g3f54vapHidSe9V EnjwL1Tc162rpeILdn30E/eWdb9q1SWLp8he9tCljMjt8GoTk1TnCWYUBCAXYUjETsPw jf1ikxlxoqvSD6qMFbzm780mEs/pxErdgkNpk= 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=FaU9NsFk6IDRpiRyWEpBwjR/WYLKsDtjocgNpOxMWpQPZJt5lnLmN7aSwbNzc1fdoP hb8UjRcoaXbxcse1o/D89BXo8cF5ALsc9TrBZ0otPMzznbB8CAV2TY+IWY066mtU3wpA FMSsFUDEfts/+aQu6s7ak0bzEiCCBDsxTx4O0= MIME-Version: 1.0 Received: by 10.114.33.33 with SMTP id g33mr2990354wag.212.1259886885862; Thu, 03 Dec 2009 16:34:45 -0800 (PST) In-Reply-To: References: <26635563.post@talk.nabble.com> Date: Thu, 3 Dec 2009 16:34:45 -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 is a list in the v1 of the spec http://json-rpc.org/wiki/specification "params - An Array of objects to pass as arguments to the method." the name of the parameters is irrelevant, only the order is. musachy On Thu, Dec 3, 2009 at 4:31 PM, Musachy Barroso wrote: > I take it back, sorry. The problem is that JSON RPC expects "params" > to be a list, and it is coming as a map, I haven't kept up with the > "spec", is it a map these days? > > musachy > > On Thu, Dec 3, 2009 at 4:28 PM, Musachy Barroso wrote= : >> 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 =A0break 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= using >>> post method. I have set content type, content length as suggested in th= e >>> spec. The request body looks like as follows : >>> {"method": "uploadTxpAssignment","id": "txpUploadRequest", >>> "params":{"addressByDestAddrId":{"addrLine1":"test home","addrLine2":"7= th >>> ave","addressId":2,"aptRoomNo":5,"city":"queens","phone":"435-577-4567"= ,"state":"NY","zipCode":10183},"atDestTime":null,"callRcvdTime":"2009-11-26= T08:01:00","comments":"comments1","dateCreated":"2009-11-26T00:00:00","date= Modified":null,"user":{"dateCreated":null,"dateModified":null,"dob":"1956-0= 9-18T00:00:00","firstName":"passfname","gender":"Male","lastName":"patient1= lname","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.= List >>> java.lang.ClassCastException: java.util.HashMap cannot be cast to >>> java.util.List >>> =A0 =A0 =A0 =A0at org.apache.struts2.json.JSONInterceptor.invoke(JSONIn= terceptor.java:204) >>> =A0 =A0 =A0 =A0at >>> org.apache.struts2.json.JSONInterceptor.intercept(JSONInterceptor.java:= 131) >>> =A0 =A0 =A0 =A0at >>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInv= ocation.java:237) >>> =A0 =A0 =A0 =A0at >>> org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.jav= a:52) >>> =A0 =A0 =A0 =A0at >>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:= 488) >>> =A0 =A0 =A0 =A0at >>> org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatche= r.java:395) >>> >>> I am also using Spring 2.5 and Hibernate JPA in the same app.... Not su= re if >>> there is any conflict.I have followed the simple rules to set up the JS= ON >>> 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= .html >>> 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