[mashup-dev] A couple of primitive samples
Jonathan Marsh
jonathan at wso2.com
Fri Apr 27 08:18:10 PDT 2007
Yes, and I generally do that. This particular bit of code came from a sample with the WSRequest object and I haven't changed it yet.
Note that I have gotten burned in the past by using the . notation when the property value is a reserved word or a property. For instance options.length and options["length"] are different. Sometimes when struggling to get things working at a bare level, sticking with the maximally escaped version helps ;-).
I also believe that for this sample both the HTTPMethod and the useWSA are unnecessary, but I ran into a problem to do with SOAPAction vs. wsa:Action when I removed them. I'll look into that issue soon.
Jonathan Marsh - http://www.wso2.com - http://auburnmarshes.spaces.live.com
> -----Original Message-----
> From: mashup-dev-bounces at wso2.org [mailto:mashup-dev-bounces at wso2.org]
> On Behalf Of Thilina Gunarathne
> Sent: Thursday, April 26, 2007 10:19 PM
> To: mashup-dev at wso2.org
> Subject: Re: [mashup-dev] A couple of primitive samples
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> > I noticed this in converterService.js:
> >
> > options = new Array();
> > options["useSOAP"] = 1.1;
> > options["HTTPMethod"] = "POST";
> > options["useWSA"] = "1.0";
> >
> > I believe the idiomatic way to do an associative array in JS is to
> use
> > an object not an array, so the user can just write
> >
> > options = new Object();
> > options.useSOAP = 1.1
> > options.HTTPMethod = "POST"
> > options.useWSA = 1.0
>
> I'm big +1 for this.. This will make the API clean as well as
> consistent
> with our APPClient API options,parameters too...
>
> I just kept this as a array in the new WSRequest host object in order
> to
> be consistent with the other WSRequest implementations (WSRequest API
> points to the PHP wsclient options array[1])..
>
> IMHO it's time to do a revise of the WSRequest API it self[2]..
>
> Thanks,
> Thilina
>
> [1]http://wso2.org/wiki/display/wsfajax/wsrequest_specification
> [2]http://wso2.org/mailarchive/wsf-general/2007-April/000087.html
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (GNU/Linux)
>
> iD8DBQFGMYfLTt0cKycFPQgRAofqAJ9RrMt6BSIX3nCMl6MXKoN+R0gpUgCfcaYe
> u1GLk/ffJJH1pnYxGVaSthY=
> =2O07
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Mashup-dev mailing list
> Mashup-dev at wso2.org
> http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev
More information about the Mashup-dev
mailing list