Monday, September 21, 2015

[WSO2 ESB] How to read a value from xml file stored in a registry

You can do like this. Here we have below test.xml file stored in gov:/test.xml

Your synapse configuration should be like this. Here we use xapth to read the XML.

Your output log will look like this.

[2015-09-21 16:01:28,750]  INFO - LogMediator Book_Name = A Song of Ice and Fire 

Please comment below if you have any questions.

Related:
How to read a file from registry
How to read a registry property

Tuesday, September 8, 2015

[WSO2 ESB] How to URL Encode in WSO2 ESB

You can do this using either Script mediator or Class mediator. Here I'm discussing about how to use Script mediator.

In javascript, there are 2 ways to do URL encoding.

1) encodeURIComponent() - This should be used only to encode query parameters.

eg. name=John Conner

2) encodeURI() - This is used to encode an entire URL.

eg. www.transformers.com/charactors?name=John Conner

If you have any questions, please comment below.

Tuesday, September 1, 2015