struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Musachy Barroso <musa...@gmail.com>
Subject Re: Problem with Struts 2 JSON RPC using simple HTTP Post (not using DOJO)
Date Fri, 04 Dec 2009 00:34:45 GMT
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 <musachy@gmail.com> 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 <musachy@gmail.com> 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  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 <prbhadra@gmail.com> 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 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-26T08:01:00","comments":"comments1","dateCreated":"2009-11-26T00:00:00","dateModified":null,"user":{"dateCreated":null,"dateModified":null,"dob":"1956-09-18T00:00:00","firstName":"passfname","gender":"Male","lastName":"patient1lname","mi":null,"ssn":null,"userId":10000}}}
>>>
>>> The struts.xml configurations are :
>>> <action name="UploadAction" class="com.actions.upload.UploadAction"
>>> method="smd">
>>>          <interceptor-ref name="json">
>>>      true
>>>      false
>>>   </interceptor-ref>
>>>   <result type="json">
>>>      true
>>>        false
>>>             text/plain
>>>                                1024
>>>                                false
>>>                                UTF-8
>>>        </result>
>>>    </action>
>>>
>>> The simple action code body :
>>> public class UploadCallreportAction {
>>>        private TransportAssignmentVO transport;
>>>        /**
>>>         * @return the transport
>>>         */
>>>        public TransportAssignmentVO getTransport() {
>>>                return transport;
>>>        }
>>>
>>>        /**
>>>         * @param transport the transport to set
>>>         */
>>>        public void setTransport(TransportAssignmentVO transport) {
>>>                this.transport = transport;
>>>        }
>>>
>>>        public String smd() {
>>>        return Action.SUCCESS;
>>>    }
>>>
>>>    @SMDMethod
>>>    public void uploadTxpAssignment(TransportAssignmentVO txpVO) {
>>>        setTransport(txpVO);
>>>      System.out.println("The Tansport assignment is for Run #:"+
>>> transport.getRunNumber());
>>>      }
>>> }
>>>
>>> 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
>>>        at org.apache.struts2.json.JSONInterceptor.invoke(JSONInterceptor.java:204)
>>>        at
>>> org.apache.struts2.json.JSONInterceptor.intercept(JSONInterceptor.java:131)
>>>        at
>>> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
>>>        at
>>> org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
>>>        at
>>> org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
>>>        at
>>> 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.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


Mime
View raw message