[Json-rpc-java] passing a bean to a jsonrpc call
Arthur Blake
arthur.blake at gmail.com
Sat Jul 28 07:17:48 SGT 2007
What does the source code look like for the
com.opsec.gnetadmin.dto.CSReportBean class?
Are you providing a public getter & setter for each field?
On 7/27/07, Cosio, Dan <dcosio at opsecsecurity.com> wrote:
>
> I also notices another strange thing.. I originally had my service return
> a CSReportBean object.. But I kept getting an exception with that also. If I
> returned the CSReportBean in a List object then that test works ok..
>
> So, I really have 2 issues
> 1. returning the bean (without putting it in a list.. putting it in a list
> works)
> 2. sending the request to a method that requires a CSReportBean.. Im
> sending { \"javaClass\":\"com.opsec.gnetadmin.dto.CSReportBean\",\"timeFrame\":\"All\"}
> for the test and it won't unmarshall in the servlet..(BTW: the '\' are
> excapes add to the quotes by javascript..
>
> I went through the forums and I think Im doing this ok. for the most
> part.. But, Im missing something.. Do I have to register the bean
> somewhere??
>
> Thanks
> Dan
>
> ________________________________
>
> From: Cosio, Dan
> Sent: Fri 7/27/2007 1:37 PM
> To: json-rpc-java at oss.metaparadigm.com
> Subject: passing a bean to a jsonrpc call
>
>
> I've been using jsonrpc for some simple method calls(Strings) but now I
> need to pass in a custom bean and I'm getting an unmarshalling error..
>
> This is my js function making the call
> function runReport()
>
> {
>
> var bean = createJSONObject();
>
> //This is the "bean" value { \"javaClass\":\"
> com.opsec.gnetadmin.dto.CSReportBean\",\"timeFrame\":\"All\"}
>
> genReport();
>
> var csbean = jsonrpc.ReportService.runCSReport(function (result,exception)
>
> {
>
> if(exception == null && result != null)
>
> {
>
> var r = result.list[0]
>
> showResults(r.reportLink,r.reportResults);
>
> }
>
> else
>
> {
>
> if(exception != null)
>
> {
>
> showError(exception);
>
> }
>
> }
>
> },bean);
>
> }
>
>
> This is the service method
> public List runCSReport(CSReportBean csbean)
> {
> csbean.setReportResult("Test Result");
> List l = new ArrayList(csbean);
> return csbean;
> }
>
> If I change the runCSReport parameter to a String(and modify the code)
> this call works find.. It's breaks when I us the custom bean..As far as I
> can tell I have formatted the object correctly so if can me
> marshalled/unmarshalled..
>
> Can anyone give me a pointer as to what Im doing wrong.
>
> Thanks
> Dan
> _______________________________________________
> Json-rpc-java mailing list
> Json-rpc-java at oss.metaparadigm.com
> http://oss.metaparadigm.com/mailman/listinfo/json-rpc-java
>
More information about the Json-rpc-java
mailing list