WSO2 ESB Javascript replace with regular expressions - wso2

I am trying to use the replace function of a javascript String with a regular expression as the first argument. It causes an error because the parameter does not fix the replace arguments (char, char). The sentence is:
prop = prop.replace(/'/g,"");
I test the instruction in chrome javascript console and it works as expected. The problem seems to be that the javascript version wso2 uses does not implement this feature.
Any help?

To achieve a better productivity with javascript, it is recommended to use the script mediator to do your javascript validations in WSO2 ESB. You can use inline javascript codes as well as to save the javascirpt in registry and re-use when necessary. Please refer to the following link [1] for more details on how to implement the script mediator using WSO2 ESB.
[1] https://docs.wso2.com/display/ESB490/Script+Mediator
Regards,
Pubudu.

Related

JMeter replace HTTP method or protocol

I want to replace all/most of HTTP Request's method or protocol
I tried to use Search option in JMeter (also in latest nightly) and I'm finding the http protocol or CONNECT method but when clicking replace none of the occurrences have changed
How can I replace it in JMeter script? only using notepad search&replace?
It’s not possible except in texteditor.
It is partly intentional as search/replace feature in JMeter is built for correlation / variabilization than for pure replacement.
Still if you feel it should be possible, propose a patch after discussion on dev mailing list.

How do i create a google places like API in Nodejs using express

I am trying to create a RESTful service in Node.js using express like the Google places API which should be in the following format.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=%1,%2&radius=%3&name=%4&key=AIzaSyAh4t-qlMYrxnk0XF0Yiu9ZXVFDNfPTCFs
Its very unlike the standard way of passing params to an express app which expects in the following format /google/nearbysearch/place/:location=%1,%2/radius/:radius=%3 and etc..
The challenge here is how to use express and decrypt the response to easily parsing the params to a call. I did extensive research but could not find any links on google or stackOverflow. Thanks for the help.
I hear and have checked out restify (http://mcavage.me/node-restify/) where it allows to pass regex strings to the request url. How do they achieve such in Node.js (solutions without using express will also be helpful).
Thanks
Anurag
You can use Connect.js and Express.js middlware to parse the incoming query string and body conveniently. You can go to the official website http://expressjs.com or look at my examples http://expressjsguide.com and http://webapplog.com.
It's possible to parse without them, but you'll have to write more code (look at the core modules at http://nodejs.org/api).

where i can learn WSO2 ESB expressions

I am doing some POC using WSO2 ESB and other stack. I have seen different expression for property files in some examples scenario.
i.e. expression="get-property('registry','conf:/test.xml')"
expression="$ctx:customerID"
can anyone tell me where i can find all these expression syntax.
Expressions are about retrieving the value. These will be useful,
http://rajikak.blogspot.com/2010/04/xpath-functions-and-properties-avilable.html
http://docs.wso2.org/display/ESB470/Mediators
The second points to official documentation of WSO2 ESB where each mediator is explained in detail.
Below link explain all the expression we need to access the message passing through the ESB.
http://docs.wso2.org/display/ESB470/Properties+Reference

Programmatically get Google search results

How can I get Google search results from inside a program? I need to get an array of search results for a specified string.
C++ requires a little more work then other languages. You will need to connect to Google's REST Search API and then use a JSON parser to parse out the search results. Json.org has a collection of JSON parsers in various languages.
Use their javascript search API http://code.google.com/apis/ajaxsearch/
They no longer support their SOAP search api unfortunately
So... nine years later, you can no longer do that. You do get JSON, but it's quite short and just says "The Google Web Search API is no longer available. Please migrate to the Google Custom Search API (https://developers.google.com/custom-search/)"
Google Custom Search can search the entire web using the 'Thing' schema.org topic. https://support.google.com/customsearch/answer/4513886?visit_id=636769478248533420-865620074&rd=1
Google offers Ajax API for JavaScript programmers and a poor documentation for Python, PHP and Flash.By the way, If you are able to connect to remote http server with any other c++ library, you can do it. just change the url you are using and point it to: http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={My_CPP_Query}
You will get JSON data stream, that you will be able to work with.
i remember i saw youtube tutorial on doing that, not sure about the library name but its something like _NT_SEARCH_GH:etcetcetcetcetcetc;

ColdFusion Webservice Parameter Structures

We are trying to consume web services with ColdFusion.
I am able to interact with the web service for the most part, however, there is one service where ColdFusion is throwing a "Parameters Could Not Be Found" error because the response message in the WSDL for this particular service is a blank parent class. I need to add the specific parameters of corresponding subclass that inherits the class pointed to in the service of the WSDL.
Is there a way to tell ColdFusion to use a certain class definition for the parameters?
Or, is there a ColdFusion tool for showing the acceptable parameter formats for a given WSDL?
EDIT
Or, is there a way to hook into the ColdFusion code that does the parsing/conversion of the parameter structure from the WSDL?
My guess is that even finding a third-party tool will not help much because I need to know what ColdFusion is going to do, not what the data SHOULD be; I know what it should be.
You can use your own WSDL file, you don't have to use the one generated by ColdFusion, just generate one, customize it and point people to your custom WSDL file instead of the YourComponent.cfc?WSDL url.
This article on consuming complex web services may help:
http://tjordahl.blogspot.com/2008/04/reprint-consuming-web-service-complex.html
Also note that if you have a copy of Dreamweaver laying around, it has a tool for inspecting WSDL and generating the required ColdFusion code.
Or, is there a ColdFusion tool for showing the acceptable parameter formats for a given wsdl?
Please see this SO question and answer
Maybe my code samples can help you.