wso2esb - How to read request parameter values in wso2 esb script mediator -
i need catch url parameters parsing in request script mediator. uses wso2 esb 4.8.1. , tried following js code. gives error saying window not defined.
function geturlvars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } var requestnew="<m:viw xmlns:m=\"wom\"> <m:request> <requestheader> <remoteip>dummyip</remoteip> <appname>dummyappname</appname> <apppassword>dummypassword</apppassword> <username>dummyusername</username> </requestheader> <orderid>23</orderid> <accountno>23</accountno> <cir>23</cir> <docketno>23</docketno> <status>23</status> <requesttype>23</requesttype> <requestedfrom>2016-04-19t22:47:37.000z</requestedfrom>"; requestnew=requestnew+" <requestedto>"+geturlvars()['requestedto']+"</requestedto> </m:request> </m:viw>"; mc.setpayloadxml(new xml(requestnew));
so how can access url parameter values in wso2 esb script mediator?
following blog tell how it. written targetting wso2 api cloud. since synapse used in both esb , api manager, valid question well. in summary,
to retrieve path parameters
var id = mc.getproperty('uri.var.id');
to retrieve query parameters
var mask = mc.getproperty('query.param.mask');
Comments
Post a Comment