<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by prabushi samarakoon on Medium]]></title>
        <description><![CDATA[Stories by prabushi samarakoon on Medium]]></description>
        <link>https://medium.com/@prabushi?source=rss-9fe06995ea54------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gQfYDK7q3_trbgvH.</url>
            <title>Stories by prabushi samarakoon on Medium</title>
            <link>https://medium.com/@prabushi?source=rss-9fe06995ea54------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:21:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@prabushi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using encrypted passwords in WSO2 Micro Integrator]]></title>
            <link>https://medium.com/@prabushi/using-encrypted-passwords-in-wso2-micro-integrator-a0020d2659a?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0020d2659a</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[integration-studio]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[wso2esb]]></category>
            <category><![CDATA[integration]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Wed, 17 Jul 2019 17:40:55 GMT</pubDate>
            <atom:updated>2019-07-18T05:59:46.922Z</atom:updated>
            <content:encoded><![CDATA[<p>When we are developing synapse configurations, which are to be deployed in <strong>WSO2 Enterprise Integrator</strong> or in <strong>WSO2 Micro Integrator</strong> (MI), as a best practice, we should always try to avoid defining any sensitive data within the configuration. WSO2 provides the S<strong>ecure Vault</strong> implementation, which allows encrypting and storing passwords that can be referred using respective aliases, which can be used instead of hard-coding password values.</p><p>Today, let’s see how to encrypt passwords and test it within WSO2 MI, which is embedded in WSO2 Integration Studio. Here, I am using WSO2 Integration Studio 6.5.0 release distribution for implementation.</p><h3><strong>Encrypting a password in WSO2 MI</strong></h3><p>Once you have extracted the <strong>WSO2 Integration Studio</strong>, you can find the <strong>embedded WSO2 MI</strong> inside &lt;Integration-Studio-HOME&gt;/runtime/microesb directory. If you are using a MacOS related distribution, you can find WSO2 MI in IntegrationStudio.app/Contents⁩/Eclipse⁩/microesb directory.</p><p>You can follow these steps to encrypt a password in WSO2 MI.</p><ol><li><a href="https://github.com/prabushi/Blog-Content/blob/master/encrypt-passwords-mi/jar/org.wso2.ciphertool-1.0.0-wso2v8.jar">Download</a> <strong>org.wso2.ciphertool-1.0.0-wso2vXX.jar,</strong> and add it inside the embedded MI. Here, I am copying it to microesb/wso2/lib directory. Then, we need to change the <strong>CARBON_CLASSPATH</strong> in microesb/bin/ciphertool.sh according to the org.wso2.ciphertool jar location. Since I copied it inside microesb/wso2/lib directory, I need to define <strong>CARBON_CLASSPATH</strong> as <strong>“$CARBON_HOME”/wso2/lib/org.wso2.ciphertool*.jar</strong></li></ol><pre># update classpath</pre><pre>CARBON_CLASSPATH=&quot;&quot;</pre><pre>for f in &quot;$CARBON_HOME&quot;/wso2/lib/org.wso2.ciphertool*.jar</pre><pre>do</pre><pre>CARBON_CLASSPATH=$CARBON_CLASSPATH:$f</pre><pre>done</pre><pre>CARBON_CLASSPATH=$CARBON_CLASSPATH:$CLASSPATH</pre><p>2. Go inside the microesb/bin directory, and run <strong>securevault.sh</strong> as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MhqULvLGpAaJQ8LHAd60fg.png" /></figure><p>Enter the secret alias for [Please Enter the Secret Alias], and enter the actual password value for both [Enter Plain Text Value : ] and [Please Enter Value Again : ]. (Default value for the Primary KeyStore Password of Carbon Server is wso2carbon)</p><p>Once it is done, If you go to microesb/registry/config/repository/components/secure-vault/secure-vault.properties file, you can see the encrypted password and its alias.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hdCX-blzGVnLvJrbJ9cNcA.png" /></figure><p>Once we have defined the required secret aliases, we can implement our synapse configuration using the pre-configured encrypted passwords along with <strong>wso2:vault-lookup</strong> key word.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VyJo1lGPY6i_d390jPzdFA.png" /></figure><h3><strong>Testing encrypted passwords with WSO2 Integration Studio</strong></h3><p>First, we need to configure secure vault in the embedded MI. For that, we can run sh ciphertool.sh -Dconfigure in microesb/bin directory. (Default value for the Primary KeyStore Password of Carbon Server is wso2carbon)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4QJIwmLDQ5abj2UyP4HB9w.png" /></figure><p>Once we enabled secure vault in MI server, we won’t be able to start it through Integration Studio as it requires entering the password for primary keystore while starting the server. <a href="https://docs.wso2.com/display/Carbon440/Resolving+Encrypted+Passwords">WSO2 Carbon provides the capability</a> to store these values in a file, which are required at server start. In that case, we do not need to enter them manually. We can use the same approach here, so that we can start the MI server via Integration Studio. In order to do that, we have to create a file named <strong>password-persist</strong> (If you are on Windows, file name should be <strong>password-persist.txt</strong>) inside microesb directory, and save the primary keystore password value there. If you are using the default keystore configuration, password value will be wso2carbon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkGiJOh-QgK1Z4saY00twQ.png" /></figure><p>Now, we can run and test your configuration with <strong>WSO2 Integration Studio</strong> as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7hxdpPft_zx_-L8Ia2UJ8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHGEGyR7hiEdtzZkTbU2mA.png" /></figure><ul><li><a href="https://docs.wso2.com/display/EI650/Encrypting+Passwords+in+WSO2+Micro+Integrator#EncryptingPasswordsinWSO2MicroIntegrator-EncryptingpasswordsforsynapseconfigurationsinWSO2MicroIntegrator">Encrypting Passwords in WSO2 Micro Integrator</a></li><li><a href="https://docs.wso2.com/display/Carbon440/Resolving+Encrypted+Passwords">Resolving Encrypted Passwords - Carbon 4.4.0 - WSO2 Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0020d2659a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross Origin Resource Sharing for WSO2 EI data services]]></title>
            <link>https://medium.com/@prabushi/cross-origin-resource-sharing-for-wso2-ei-data-services-ab4aa675dd71?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab4aa675dd71</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[cors]]></category>
            <category><![CDATA[data-services]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Sun, 28 Apr 2019 19:10:12 GMT</pubDate>
            <atom:updated>2019-04-28T19:10:12.751Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing">Cross Origin Resource Sharing</a> (CORS) is a standard mechanism to ensure resource sharing policies, which allow or restrict requests across domains. It defines a set of headers to carry the details of the boundaries between browser and server upon a cross-domain request. WSO2 Enterprise Integrator supports enabling CORS for the data services deployed in the ESB runtime.</p><p>WSO2 Carbon products, including WSO2 EI, use the <a href="https://docs.wso2.com/display/EI611/HTTPS+Servlet+Transport">Apache Tomcat connector</a> implementation as the HTTP transport sender for its web application. According to the default configurations defined in <strong>EI-HOME/conf/tomcat/catalina-server.xml</strong> file, <strong>org.apache.coyote.http11.Http11NioProtocol</strong> connector implementation is bounded to 9443 port. Therefore, when filters are added in the <strong>EI-HOME/conf/tomcat/web.xml</strong> file, those filters will be applied to the configured tomcat servlet port, which is 9443 by default.</p><h3><strong>How to configure CORS in WSO2 EI</strong></h3><p>Following steps can be used to enable CORS in WSO2 EI.</p><ol><li>Copy <strong>cors-filter-2.4.jar</strong> and <strong>java-property-utils-1.9.1.jar</strong> into <strong>WSO2-EI/lib</strong> directory.</li><li>Add filters in <strong>EI_HOME/conf/tomcat/web.xml</strong> file.</li></ol><pre>&lt;filter&gt;<br>  &lt;filter-name&gt;CORS&lt;/filter-name&gt;<br>  &lt;filter-class&gt;com.thetransactioncompany.cors.CORSFilter&lt;/filter-class&gt;<br>  &lt;init-param&gt;<br>    &lt;param-name&gt;cors.allowOrigin&lt;/param-name&gt;<br>    &lt;param-value&gt;*&lt;/param-value&gt;<br>  &lt;/init-param&gt;<br>  &lt;init-param&gt;<br>    &lt;param-name&gt;cors.allowed.methods&lt;/param-name&gt;<br>    &lt;param-value&gt;GET,POST,HEAD,OPTIONS,PUT&lt;/param-value&gt;<br>  &lt;/init-param&gt;<br>  &lt;init-param&gt;<br>    &lt;param-name&gt;cors.supportedHeaders&lt;/param-name&gt;<br>    &lt;param-value&gt;Content-Type, SOAPAction, Accept&lt;/param-value&gt;<br>  &lt;/init-param&gt;<br>&lt;/filter&gt;<br>&lt;filter-mapping&gt;<br>    &lt;filter-name&gt;CORS&lt;/filter-name&gt;<br>    &lt;url-pattern&gt;*&lt;/url-pattern&gt;<br>&lt;/filter-mapping&gt;</pre><p>Please refer <a href="https://docs.wso2.com/display/EI640/Enabling+CORS+for+Data+Services">WSO2 Documentation</a> for more details about applying filter configurations.</p><p>Aforementioned filter configurations adhere to the <strong>com.thetransactioncompany.cors.CORSFilter</strong> <a href="https://github.com/LuisSala/CORS-Java-Servlet-Filter/blob/master/src/com/thetransactioncompany/cors/CORSFilter.java">class</a> implementation. For example, according to its <a href="https://github.com/LuisSala/CORS-Java-Servlet-Filter/blob/master/src/com/thetransactioncompany/cors/CORSConfiguration.java#L306">implementation</a>, we can use <strong>cors.supportedHeaders</strong> parameter to define all the HTTP headers supported from the server side.</p><h3><strong>Verifying the filters</strong></h3><p>Here, the sample data service “SecureDataService” along with a simple web application is being used to verify the CORS filtering.</p><p>1. Configure data service samples following <a href="https://docs.wso2.com/display/EI630/Samples+Setup">this</a> documentation.<br>Go to <strong>EI_HOME/samples/data-services</strong> directory, and run ant clean to remove existing data services.<br>Then, run ant to deploy all the samples.<br>Start the server and check for the <strong>SecureDataService</strong> data service.</p><p>2. Create a simple web application that makes an ajax call to SecureDataService.</p><p>Get an Apache tomcat server, and create a directory within the <strong>webapps</strong> directory. (eg: apache-tomcat-7.0.88/webapps/MyApp)<br>Create a <strong>index.html</strong> file with an ajax call as below, within the created directory, and start the tomcat server.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body&gt;<br>&lt;h2&gt;The XMLHttpRequest Object Sample&lt;/h2&gt;<br>&lt;button type=&quot;button&quot; onclick=&quot;sendRequest()&quot;&gt;Send Request&lt;/button&gt;<br>&lt;p id=&quot;sample&quot;&gt;&lt;/p&gt;<br>&lt;script&gt;<br>function sendRequest() {<br>  var xhttp = new XMLHttpRequest();<br>  xhttp.onreadystatechange = function() {<br>    if (this.readyState == 4 &amp;&amp; this.status == 200) {<br>      document.getElementById(&quot;sample&quot;).innerHTML = this.responseText;<br>    }<br>  };<br>  xhttp.open(&quot;POST&quot;, &quot;<a href="https://prabushi-thinkpad-x1-carbon-4th:9443/services/samples/SecureDataService/showAllOffices">https://localhost:9443/services/samples/SecureDataService/showAllOffices</a>&quot;, true);<br>  xhttp.setRequestHeader(&quot;Content-Type&quot;, &quot;text/xml&quot;);<br>  xhttp.setRequestHeader(&quot;SOAPAction&quot;, &quot;urn:showAllOffices&quot;);<br>  xhttp.setRequestHeader(&quot;Origin&quot;, &quot;<a href="http://localhost:8080/">http://localhost:8080</a>&quot;);<br>  xhttp.setRequestHeader(&quot;Accept&quot;, &quot;text/xml&quot;);<br>  xhttp.send();<br>}<br>&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>When we click on the button, an ajax request is sent to the servlet port of the WSO2 EI server. First, the browser preflights the request, and sends a HTTP OPTIONS method call to check the server supported methods, headers, etc. Usually, the HTTP OPTIONS method request is being made from the browser except for a GET or a POST request with some MIME types. Upon the approval, second call is made with the original request. It will be responded back with <strong>Access-Control-Allow-Origin </strong>and<strong> Access-Control-Allow-Credentials</strong> HTTP headers along with other information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1D3v4kyt36q61BawXFNqA.png" /><figcaption>The HTTP OPTIONS call</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkoPbY7kqLzWquqMN9jDkg.png" /><figcaption>The original request</figcaption></figure><p>If the request fails to adhere to the allowed HTTP methods, HTTP headers, etc., the client request will be forbidden at the HTTP OPTIONS method call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h5MuvIDQ8ShwaKIadhmcbQ.png" /><figcaption>A forbidden request</figcaption></figure><p><a href="https://docs.wso2.com/display/EI640/Enabling+CORS+for+Data+Services">Enabling CORS for Data Services - WSO2 Enterprise Integrator 6.4.0 - WSO2 Documentation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab4aa675dd71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Synchronous execution of tasks with WSO2 EI Scheduled Tasks]]></title>
            <link>https://medium.com/@prabushi/synchronous-execution-of-tasks-with-wso2-ei-scheduled-tasks-24f68ce070e7?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/24f68ce070e7</guid>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[scheduled-tasks]]></category>
            <category><![CDATA[wso2esb]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Sat, 06 Apr 2019 15:27:09 GMT</pubDate>
            <atom:updated>2019-04-07T07:15:04.932Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 Enterprise Integrator has the in built capability to periodically execute tasks with its scheduled tasks implementation [1]. It can either be used to continuously trigger a task at a certain time intervals or it can be configured to follow a cron expression. Within the scheduled task, WSO2 EI allows to inject the message into an endpoint, a proxy service or a sequence, which holds the mediation flow to be carried out from that task.</p><p>By default, scheduled tasks work asynchronously, where the message injection into a sequence or a proxy is handled by different threads. However, injecting into a proxy service can be configured in a synchronous manner with the use of the blocking call [2] and the quartz properties [3].</p><p>Following is a sample which depicts the synchronous and asynchronous behaviors of the scheduled tasks in WSO2 EI.</p><h3>Asynchronous task execution</h3><p>This is the sample backend service which is called by the proxy service. Once the message is received from the backend, it waits for 180 seconds, and responds back.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;api xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot;<br>     name=&quot;backend-service&quot;<br>     context=&quot;/backend&quot;&gt;<br>   &lt;resource methods=&quot;POST GET&quot;&gt;<br>      &lt;inSequence&gt;<br>         &lt;log level=&quot;custom&quot; description=&quot;log-init-sequence&quot;&gt;<br>            &lt;property name=&quot;Start backend : &quot; value=&quot;START&quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;script language=&quot;js&quot;&gt;java.lang.Thread.sleep(180000);<br>         &lt;/script&gt;<br>         &lt;log level=&quot;custom&quot; description=&quot;log-end-sequence&quot;&gt;<br>            &lt;property name=&quot;End backend : &quot; value=&quot;END&quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;respond/&gt;<br>      &lt;/inSequence&gt;<br>   &lt;/resource&gt;<br>&lt;/api&gt;</pre><p>The message is injected to the following proxy service by the configured task, and this proxy service calls the above mentioned backend upon a message arrival.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;proxy xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot;<br>       name=&quot;proxyService&quot;<br>       transports=&quot;http https&quot;<br>       startOnLoad=&quot;true&quot;&gt;<br>   &lt;description/&gt;<br>   &lt;target&gt;<br>      &lt;inSequence&gt;<br>         &lt;log level=&quot;custom&quot;&gt;<br>            &lt;property name=&quot;Init proxy : &quot; value=&quot;INIT&quot;/&gt;<br>         &lt;/log&gt;<br>         &lt;call&gt;<br>            &lt;endpoint&gt;<br>               &lt;address uri=&quot;<a href="http://localhost:8280/backend">http://localhost:8280/backend</a>&quot;&gt;<br>                  &lt;suspendOnFailure&gt;<br>                     &lt;errorCodes&gt;-1&lt;/errorCodes&gt;<br>                     &lt;progressionFactor&gt;1.0&lt;/progressionFactor&gt;<br>                  &lt;/suspendOnFailure&gt;<br>                  &lt;markForSuspension&gt;<br>                     &lt;errorCodes&gt;-1&lt;/errorCodes&gt;<br>                  &lt;/markForSuspension&gt;<br>               &lt;/address&gt;<br>            &lt;/endpoint&gt;<br>         &lt;/call&gt;<br>      &lt;/inSequence&gt;<br>      &lt;outSequence&gt;<br>         &lt;send/&gt;<br>      &lt;/outSequence&gt;<br>   &lt;/target&gt;<br>&lt;/proxy&gt;</pre><p>Following task is configured to inject the message in every 60 seconds using a cron expression.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;task xmlns=&quot;<a href="http://ws.apache.org/ns/synapse">http://ws.apache.org/ns/synapse</a>&quot;<br>      name=&quot;sampleTest&quot;<br>      class=&quot;org.apache.synapse.startup.tasks.MessageInjector&quot;<br>      group=&quot;synapse.simple.quartz&quot;&gt;<br>   &lt;trigger cron=&quot;0 0/1 * 1/1 * ? *&quot;/&gt;<br>   &lt;property xmlns:task=&quot;<a href="http://www.wso2.org/products/wso2commons/tasks">http://www.wso2.org/products/wso2commons/tasks</a>&quot; name=&quot;message&quot;&gt;<br>      &lt;request xmlns=&quot;&quot;&gt;<br>         &lt;operation&gt;test&lt;/operation&gt;<br>      &lt;/request&gt;<br>   &lt;/property&gt;<br>   &lt;property xmlns:task=&quot;<a href="http://www.wso2.org/products/wso2commons/tasks">http://www.wso2.org/products/wso2commons/tasks</a>&quot;<br>             name=&quot;proxyName&quot;<br>             value=&quot;proxyService&quot;/&gt;<br>   &lt;property xmlns:task=&quot;<a href="http://www.wso2.org/products/wso2commons/tasks">http://www.wso2.org/products/wso2commons/tasks</a>&quot;<br>             name=&quot;injectTo&quot;<br>             value=&quot;proxy&quot;/&gt;<br>&lt;/task&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PPQb2YLgMsfe4D7PceX2Jw.png" /><figcaption>Asynchronous behavior of tasks</figcaption></figure><p>According to the above logs, the asynchronous manner of task execution can be verified as each message had been injected to the proxy service in every 60 seconds intervals, and backend calls had been executed by different threads in parallel.</p><pre>             +-------+------------+--------+----------+<br>             |  Time |  Start BE  | End BE | #Threads |<br>             +-------+------------+--------+----------+<br>             | 18.27 | t1         |        |     1    |<br>             | 18.28 | t1, t2     |        |     2    |<br>             | 18.29 | t1, t2, t3 |        |     3    |<br>             | 18.30 | t2, t3, t4 |   t1   |     3    |<br>             | 18.31 | t3, t4, t5 |   t2   |     3    |<br>             | 18.32 | t4, t5, t6 |   t3   |     3    |<br>             | 18.33 | t5, t6, t7 |   t4   |     3    |<br>             +-------+------------+--------+----------+</pre><h3>Synchronous task execution</h3><p>In order to get the synchronous behavior, backend calls within the proxy service should be configured in the blocking mode [2], as follows.</p><pre>&lt;call blocking=&quot;true&quot;&gt;<br>    &lt;endpoint&gt;<br>       &lt;address uri=&quot;<a href="http://localhost:8280/backend">http://localhost:8280/backend</a>&quot;&gt;<br>          &lt;suspendOnFailure&gt;<br>             &lt;errorCodes&gt;-1&lt;/errorCodes&gt;<br>             &lt;progressionFactor&gt;1.0&lt;/progressionFactor&gt;<br>          &lt;/suspendOnFailure&gt;<br>          &lt;markForSuspension&gt;<br>             &lt;errorCodes&gt;-1&lt;/errorCodes&gt;<br>          &lt;/markForSuspension&gt;<br>       &lt;/address&gt;<br>    &lt;/endpoint&gt;<br> &lt;/call&gt;</pre><p>Then, the quartz properties file, which is included with <strong>org.quartz.threadPool.threadCount</strong> property value, should be passed to the WSO2 EI run-time as a system property. This can be done by passing the system property, <strong>org.quartz.properties, </strong>provided with the path to the <strong>quartz.properties</strong> file. The defined thread count is used to initialize the quartz scheduler [3], which is used in the underline WSO2 EI tasks’ implementation.</p><pre>org.quartz.threadPool.threadCount=1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3E1Sl3C890b52rRH3FMROQ.png" /><figcaption>Passing org.quartz.properties system property</figcaption></figure><p>Aforementioned configuration can be verified with the logs, where only one thread had been executing the backend task at a given time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FRzwwLSa0fAtRDwq9pvxew.png" /><figcaption>Synchronous behavior of tasks</figcaption></figure><ul><li><a href="https://docs.wso2.com/display/EI640/Scheduling+ESB+Tasks">Scheduling ESB Tasks - WSO2 Enterprise Integrator 6.4.0 - WSO2 Documentation</a></li><li><a href="https://docs.wso2.com/display/EI640/Call+Mediator">Call Mediator - WSO2 Enterprise Integrator 6.4.0 - WSO2 Documentation</a></li><li><a href="https://github.com/quartz-scheduler/quartz/blob/master/quartz-core/src/main/java/org/quartz/impl/StdSchedulerFactory.java#L385">quartz-scheduler/quartz</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24f68ce070e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visual cues to indicate errors in WSO2 Enterprise Integrator Tooling]]></title>
            <link>https://medium.com/think-integration/visual-cues-to-indicate-errors-in-wso2-enterprise-integrator-tooling-4d2dc5c1bd0?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d2dc5c1bd0</guid>
            <category><![CDATA[developer-studio]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[esb]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Wed, 27 Mar 2019 13:50:39 GMT</pubDate>
            <atom:updated>2020-09-02T13:35:09.556Z</atom:updated>
            <content:encoded><![CDATA[<h3>Visual cues to indicate errors in WSO2 Integration Studio</h3><p>WSO2 Integration Studio comes with the source view, which displays the xml representation of the Synapse mediation flow depicted in the design view. The source view is embedded with an XML editor, allowing users to manually edit the Synapse configuration. However, there was no additional support provided in terms of content assist nor validation, for the users who wished to work in this XML editor. Therefore, it was required to enhance the capabilities, and provide the end user with an efficient and intuitive way to develop their Synapse configuration, via the source view.</p><p>Prior versions of WSO2 Developer Studio did not allow switching between source and design views if there are any errors in the Synapse configuration, as it had no way to provide an informative description of that error, or to persist the error within an artifact. We have introduced a new validation layer in the forthcoming WSO2 Integration Studio release in order to overcome these usability gaps, and to cater these validation requirements.</p><p>Two main scenarios identified with the source view are as follows.</p><ol><li><strong><em>XML validation</em></strong></li></ol><p>If the content on source view fails basic xml validation, user will not be able to save the content, or switch to the design view. However, a descriptive detail of the error will be notified to the user so that the user can correct it and continue with the development.</p><p>2. <strong><em>Synapse validation</em></strong></p><p>If the xml content on the source view fails to adhere to the Synapse schema, user will be allowed to save the erroneous content and continue with the development while the error will be notified in detail.</p><p>Any erroneous artifact which can be caused by the aforementioned scenarios will not be listed under the Composite Application project to be included in the composite archive.</p><h3>Implementation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8tcKSlbR3VavLfM25K63eA.png" /><figcaption>Diagram 1 : Previous implementation of conversion from source to design</figcaption></figure><p>The above diagram depicts how WSO2 Integration Studio utilizes the means of WSO2 Synapse [1] to construct the mediation flow. Whenever it is being switched to the design view, WSO2 Integration Studio converts the string content on the source view to an xml representation in correspondence with the Synapse definition, using Apache OMElements [2]. WSO2 Synapse, descendant of Apache Synapse [3], has been constructed using predefined mediators such as Log mediator, Enrich mediator, etc., and artifacts such as Proxy service, API, etc. OMElement representation of each mediator is processed using the respective mediator Factory implementation in WSO2 Synapse layer to retrieve it’s correspondent Synapse object.</p><p>As per previous underline architecture of Developer Studio, content on the source view was sent to the WSO2 Synapse side at once, making it impossible to identify as to which part of the configuration has caused an error. In order to overcome this limitation, a new layer capable of addressing validation per one block of mediation was incorporated into the new Tooling architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XWq9GC5jCM-_GEfBV5X29g.png" /><figcaption>Diagram 2 : New implementation of conversion from source to design</figcaption></figure><p>The introduced validation handler comes in between the WSO2 Synapse layer and the controller of Integration Studio, which has been developed upholding to the MVC architecture. Upon the switch or save event on the source view, controller verifies the xml content against the xml validation feature with Apache SAXParser [4]. If there are no xml invalidations, it calls the respective mediator Factory implementation, and it can retrieve the details of the first error it encountered. Any asserted error is indicated using an IMarker [5], which is the general mechanism in Eclipse to bind notes or meta-data with resources. Upon an error, an IMarker will be generated associating with the respective IFile of the Synapse artifact. The generated customized marker underlines the complementary portion within the Synapse configuration highlighting the erroneous mediator, while an adequate description of the error will be shown in the Eclipse ‘Markers’ view. User will also be able to see the informative description on the mouse hover event over the error marker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_Ybw9AXS3rjNof3qjvpoQ.png" /><figcaption>Diagram 3 : IMarker Implementation</figcaption></figure><p>In addition to the error indication on the source view, new mediator factory approach was introduced to allow the user with the capability of saving an incomplete Synapse configuration even though it does not adhere to the Synapse schema. These factory classes were implemented in a manner which the Synapse objects representations will be generated irrespective of the inconsistencies within the Synapse configuration. Eclipse Decorators, which are used to annotate resources with useful information, were used along with the IMarkers to display these erroneous states of the saved artifacts. According to the new implementation, IDecorator implementation acts as a listener and continuously verifies the validity of resources within the workspace. An error will be marked with an overlay image on the resource in the Eclipse ‘Project Explorer’ view. Furthermore, WSO2 Integration Studio facilitates auto recovery, where the artifact will be assigned with default values, ignoring the faulty input values for the possible cases in which the mentioned decorators will not be added to convey the erroneous state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CeJsVCanfSg4bt95ekM-gA.png" /><figcaption>Diagram 4 : Decorator implementation</figcaption></figure><p>Upcoming WOS2 Integration Studio 6.5.0 release will be presented with the aforementioned visual cues to perceive and persist the erroneous states, with the intention of providing the end user with a more user friendly experience while developing the Synapse integration flow.</p><p>Checkout WSO2 Integration Studio 6.5.0 to explore more features.</p><p><strong><em>** Now, you can try out the latest Integration Studio from our </em></strong><a href="https://wso2.com/integration/integration-studio/"><strong><em>website</em></strong></a><strong><em>. **</em></strong></p><h3>References</h3><ul><li><a href="https://wso2.com/integration/integration-studio/">WSO2 Integration Studio</a></li><li><a href="https://github.com/wso2/wso2-synapse">wso2/wso2-synapse</a></li><li><a href="https://ws.apache.org/axiom/apidocs/org/apache/axiom/om/OMElement.html">OMElement (Apache Axiom)</a></li><li><a href="http://synapse.apache.org/">Apache Synapse - Apache Synapse - The Lightweight ESB</a></li><li><a href="https://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/parsers/SAXParser.html">XML Standard API: Class SAXParser</a></li><li><a href="https://help.eclipse.org/kepler/ntopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/resources/IMarker.html">IMarker (Eclipse Platform API Specification)</a></li><li><a href="https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fworkbench_advext_decorators.htm">Help - Eclipse Platform</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d2dc5c1bd0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/think-integration/visual-cues-to-indicate-errors-in-wso2-enterprise-integrator-tooling-4d2dc5c1bd0">Visual cues to indicate errors in WSO2 Enterprise Integrator Tooling</a> was originally published in <a href="https://medium.com/think-integration">Think Integration</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use WS-policy to secure a WSO2 proxy service]]></title>
            <link>https://medium.com/@prabushi/use-ws-policy-to-secure-a-wso2-proxy-service-33a1bfa19f5b?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/33a1bfa19f5b</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[soapui]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Wed, 27 Jun 2018 06:01:17 GMT</pubDate>
            <atom:updated>2018-06-27T06:14:06.667Z</atom:updated>
            <content:encoded><![CDATA[<p>I have used WSO2 Enterprise Server 6.2.0 and WSO2 EI Tooling 6.2.0 distribution for the following configurations. Here, I have demonstrated securing the proxy service using the WS-Policy type, <strong>Integrity </strong>[1].</p><h4>Create WS-Policy</h4><ol><li>Create a “ESB Solution Project” using the Developer Studio following the path Developer Studio -&gt; Open Dashboard -&gt; ESB Solution Project under ESB Project Types.</li><li>Add the WS-Policy as a registry resource. Follow the path Developer Studio -&gt; Open Dashboard -&gt; Registry Resource under Repository to create the registry resource to save the WS-Policy.</li><li>At the “New Registry Resource” wizard, select “From existing template” and click on “Next”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ien0KENEWNlpSHjo9rjvw.png" /></figure><p>4. Then, select “WS-Policy” for the “Template”, and fill rest of the relevant entries and click on “Finish”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RNqF2E7li_N6NoGMfC1-rA.png" /></figure><p>5. Double click on the “WS-Policy-Resource.xml” within the Registry Project and open the policy UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TtqnlBwTiczD_VrzKkY40g.png" /></figure><p>6. I have selected Integrity WS-policy for this scenario. I am using only Signature and timestamp WSS types for securing the proxy service. (i.e. I have removed the line “MustSupportIssuedTokens” from the default policy configuration to exclude the security token.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*se1JIe8yjZ6QTTKGa_JPxA.png" /></figure><p>7. You can click on the icon next to the relevant WS-policy to get a descriptive information about that policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bbrY_LM0mS0vwVYOrg5RYg.png" /></figure><p>8. Here, I am using the default Integrity web service security policy which uses WSO2 default keystore (wso2carbon.jks) to derive the key to decrypt and check the signature in the SOAP envelope.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yQjoMrUHlnANLN3DH3GgHA.png" /></figure><h4>Create Secured Proxy Service</h4><ol><li>Create a proxy service following the path Developer Studio -&gt; Open Dashboard -&gt; Proxy Service under ESB Artifact Types.</li><li>Select “Secure Proxy” for “Proxy Service Type”.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*wHU6AeRHtPqJC3srmFoqEA.png" /></figure><p>3. Click on “Browse…” at the “Security Policy” under “Advanced Configuration”, and click on “workspace” on the popup window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*53H5S0IyLtGySq33R2K2Ng.png" /></figure><p>4. Then, select the created policy, and click “ok” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*0Ehv0vxmxL2b-joV5kgDwg.png" /></figure><p>5. Add the target endpoint URL and click on “finish” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*q6MEFlmXQIg8nL0u9QkdCw.png" /></figure><p>6. Finally, create the Carbon Application and deploy the CApp in WSO2 EI server [2].</p><h4>Invoke Secured Proxy using SOAP UI</h4><ol><li>Once you deploy the Carbon Application, you can see the secured proxy listed under the available services.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y9IMXhZ-NnRbe5x29noXIg.png" /></figure><p>2. Then create a “SOAP Project” in SOAP UI using the WSDL URL of the proxy service (eg: <a href="http://localhost:8280/services/SampleProxy?wsdl">http://localhost:8280/services/SampleProxy?wsdl</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*2EtwAKVszoQFRvZ7shX26Q.png" /></figure><p>3. Double click on the created SOAP project, and specify security configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T16NUYxjfz0lRE6Did7ejQ.png" /></figure><p>4. Click on “WS-Security-Configuration” -&gt; “Keystores”, and add the WSO2 default keystore located at <strong>wso2ei-6.2.0/repository/resources/security/wso2carbon.jks</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5U7wfOYT9T9hzxDm1QWsEg.png" /></figure><p>5. We need to enter keystore password for the keystore configuration. (Password for WSO2 default keystore is wso2carbon)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*YZa_Swec6L7KMuZc0UIECQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*8UZ3PVZyBqYE6mDcMjklEQ.png" /></figure><p>6. Then, click on “Outgoing WS-Security Configuration”, and add a new policy by specifying a name. (“out-policy” is the name I have used here.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*LH-Z2vNLvK2WZXzYvADXQA.png" /></figure><p>7. Add required WSS entries for the created configuration. Here, I have added Singature and Timestamp entries according to the configured “Integrity WS Policy”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*d0VMhMGG2vH4ZCAC7RSInQ.png" /></figure><p>8. We have to configure relevant parameters for the specified WSS entries as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*Bb3oCJoR6Q-_kSvfptw5OA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*_f5PRZj90SpkbzZkhE6_Ug.png" /></figure><p>9. Once we are done with WS security configurations, we have to specify the created ws-policy (i.e. out-policy) under “Outgoing WSS” at the request “Authorization”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S5GPHnuiCchU5tMSkQa3Sg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZuHoTYPdZCfrDCiHsQB-Q.png" /></figure><p>10. Now, we can invoke the secured proxy service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7MzoH2vT88greQm3GkHpBw.png" /></figure><h4>References</h4><p>[1]- <a href="https://docs.wso2.com/display/EI620/Security+Implementation#SecurityImplementation-3.Integrity">https://docs.wso2.com/display/EI620/Security+Implementation#SecurityImplementation-3.Integrity</a></p><p>[2]- <a href="https://docs.wso2.com/display/ESB490/Creating+and+Deploying+a+Carbon+Application">https://docs.wso2.com/display/ESB490/Creating+and+Deploying+a+Carbon+Application</a></p><p>[3]- <a href="https://www.soapui.org/soapui-projects/ws-security.html">https://www.soapui.org/soapui-projects/ws-security.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33a1bfa19f5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Avoid “Input type is incorrect or Invalid element found” error with WSO2 data mapping]]></title>
            <link>https://medium.com/@prabushi/avoid-input-type-is-incorrect-or-invalid-element-found-error-with-data-mapping-801844d9daf9?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/801844d9daf9</guid>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Mon, 30 Apr 2018 05:43:41 GMT</pubDate>
            <atom:updated>2018-04-30T05:45:10.633Z</atom:updated>
            <content:encoded><![CDATA[<p>The error, <strong>Input type is incorrect or Invalid element found in the message payload</strong> is one of the common errors that we encounter while using wso2 data-mapper to map xml input. This error occurs when the input reader cannot identify the input elements that are defined in the input schema configuration. i.e. there is a mismatch between the input payload and the mapping schema.</p><pre>[2018-04-30 14:39:29,127] []  WARN - XMLInputReader Element name not found : ns0:responsetag<br>[2018-04-30 14:39:29,130] [] ERROR - DataMapperMediator DataMapper mediator : mapping failed<br>Input type is incorrect or Invalid element found in the message payload : ns0:responsetag<br>        at org.wso2.carbon.mediator.datamapper.engine.input.readers.XMLInputReader.xmlTraverse(XMLInputReader.java:174)<br>        at org.wso2.carbon.mediator.datamapper.engine.input.readers.XMLInputReader.read(XMLInputReader.java:120)<br>        at org.wso2.carbon.mediator.datamapper.engine.input.InputBuilder.buildInputModel(InputBuilder.java:59)<br>        at org.wso2.carbon.mediator.datamapper.engine.core.mapper.MappingHandler.doMap(MappingHandler.java:88)<br>        at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:309)<br>        at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:259)<br>        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:97)<br>        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:59)<br>        at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)<br>        at org.apache.synapse.rest.Resource.process(Resource.java:343)<br>        at org.apache.synapse.rest.API.process(API.java:338)<br>        at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:123)<br>        at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)<br>        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:56)<br>        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)<br>        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)<br>        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)<br>        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)<br>        at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:262)<br>        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)<br>        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br>        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br>        at java.lang.Thread.run(Thread.java:745)</pre><p>One of the common mistake we do when mapping xml input is, using the entire SOAP Envelope as the input while creating the data-mapper configuration. Data-mapper only maps the data that is coming inside the <strong>SOAP Body</strong> tag of the soap envelope. Hence, throws the above mentioned error as it cannot find the relevant tags according to the input schema.</p><h4><strong>Incorrect Input</strong></h4><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;sn:Envelope xmlns:sn=&quot;<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>&quot;&gt;<br>   &lt;sn:Body&gt;<br>      &lt;ns0:responsetag xmlns:ns0=&quot;<a href="http://www.abc.lk/cde/register">http://www.abc.lk/cde/register</a>&quot;&gt;<br>         &lt;output&gt;<br>            &lt;message&gt;<br>               &lt;code&gt;0&lt;/code&gt;<br>               &lt;message&gt;STRING&lt;/message&gt;<br>            &lt;/message&gt;<br>            &lt;success&gt;true&lt;/success&gt;<br>            &lt;information&gt;<br>               &lt;name&gt;Anne&lt;/name&gt;<br>               &lt;age&gt;18&lt;/age&gt;<br>               &lt;address&gt;<br>                  &lt;city&gt;Colombo&lt;/city&gt;                                    <br>                  &lt;province&gt;Western&lt;/province&gt;<br>                  &lt;code&gt;1200&lt;/code&gt;<br>                  &lt;number&gt;350&lt;/number&gt;<br>                  &lt;street&gt;Flower Rd&lt;/street&gt;<br>               &lt;/address&gt;<br>               &lt;desc&gt;Register user Anne&lt;/desc&gt;               <br>               &lt;id&gt;1234-abcd&lt;/id&gt;<br>            &lt;/information&gt;<br>         &lt;/output&gt;<br>      &lt;/ns0:responsetag&gt;<br>   &lt;/sn:Body&gt;<br>&lt;/sn:Envelope&gt;</pre><h4>Correct Input</h4><pre>&lt;ns0:responsetag xmlns:ns0=&quot;<a href="http://www.abc.lk/cde/register">http://www.abc.lk/cde/register</a>&quot;&gt;<br> &lt;output&gt;<br>    &lt;message&gt;<br>       &lt;code&gt;0&lt;/code&gt;<br>       &lt;message&gt;STRING&lt;/message&gt;<br>    &lt;/message&gt;<br>    &lt;success&gt;true&lt;/success&gt;<br>    &lt;information&gt;<br>       &lt;name&gt;Anne&lt;/name&gt;<br>       &lt;age&gt;18&lt;/age&gt;<br>       &lt;address&gt;<br>          &lt;city&gt;Colombo&lt;/city&gt;                                    <br>          &lt;province&gt;Western&lt;/province&gt;<br>          &lt;code&gt;1200&lt;/code&gt;<br>          &lt;number&gt;350&lt;/number&gt;<br>          &lt;street&gt;Flower Rd&lt;/street&gt;<br>       &lt;/address&gt;<br>       &lt;desc&gt;Register user Anne&lt;/desc&gt;               <br>       &lt;id&gt;1234-abcd&lt;/id&gt;<br>    &lt;/information&gt;<br> &lt;/output&gt;<br>&lt;/ns0:responsetag&gt;</pre><p>In order to avoid this error, we should only use the <strong>xml element that is coming as the SOAP Body</strong> while creating the data-mapper schema via WSO2 Developer Studio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p9PdFV4DZy3CQSRBUVEjkQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=801844d9daf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secret Alias with WSO2 Enterprise Server 6.2.0]]></title>
            <link>https://medium.com/@prabushi/secret-alias-with-wso2-enterprise-server-6-2-0-fa1834b0c52a?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa1834b0c52a</guid>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[wso2-carbon]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Tue, 20 Mar 2018 09:16:53 GMT</pubDate>
            <atom:updated>2018-03-20T09:22:22.859Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 products has the <strong>secure vault implementation</strong> which can be used to encrypt plain text passwords. With the use of WSO2 cipher tool, we can secure the passwords that are used within the synapse configurations (For example encrypt password of the data service) in WSO2 Enterprise Server, and refer only the secret alias which will be mapped and resolved at the run-time.</p><p>Following are the steps that are used to enable secret alias option within a datasource configuration in WSO2 EI 6.2.0 in a Linux environment. Here, we are using the WSO2 default keystore (<strong>wso2ei-6.2.0/repository/resources/security/wso2carbon.jks</strong>) which is shipped with the WSO2 EI pack for encryption.</p><ol><li>Execute cipher tool script to encrypt plain text passwords in WSO2 EI. Run sh bin/ciphertool.sh -Dconfigure from the <strong>&lt;WSO2_EI_HOME&gt;</strong> directory. This will encrypt all the passwords that are referred at <strong>wso2ei-6.2.0/conf/security/cipher-text.properties</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xx2mR5xyBeyksBwpy5YOww.png" /></figure><p>2. Retrieve the encrypted value for the text plain password using the cipher tool. Run ./bin/ciphertool.sh from the <strong>&lt;WSO2_EI_HOME&gt;</strong> directory. Enter your password for [Enter Plain Text Value : ] and [Please Enter Value Again : ].</p><pre>[Enter Plain Text Value : ] password-value<br>[Please Enter Value Again : ] password-value</pre><pre>Encryption is done Successfully</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5aEv-5F6Yrp1XzCZ0WBjpw.png" /></figure><p>There, you can get the encrypted value as the output. Then we need to add the encrypted value to <strong>wso2ei-6.2.0/conf/security/cipher-text.properties</strong> file.</p><p>Append the <strong>cipher-text.properties</strong> file with &lt;Secret Alias&gt;=&lt;Encrypted Value&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YjCd19On_mSkklQ5pi5_NQ.png" /></figure><p>3. Then, start the WSO2 EI server to test the encrypted value. Please make sure you have added the database driver to <strong>lib</strong> directory (For example add wso2ei-6.2.0/lib/mysql-connector-java-5.1.41-bin.jar to test a mysql database connection) before start the server.</p><p>Run ./integrator.sh from the <strong>&lt;WSO2_EI_HOME&gt;/bin</strong> directory to start the server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jimO4OeLC9Qvhlmw1eysAg.png" /></figure><p>At the server startup, server will ask for the password for WSO2 default keystore to decrypt and map the encrypted passwords at sever configurations. Enter WSO2 default password <strong>wso2carbon</strong> for default keystore <strong>wso2carbon.jks</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c7qEd9njbCekD0KNxOMQHA.png" /></figure><p>4. Log into management console using <a href="https://172.17.0.1:9443/carbon/"><strong>https://172.17.0.1:9443/carbon/</strong></a><strong> </strong>URI. <br>Then, create a data service following Main --&gt; Services --&gt; Data Service --&gt; Create path. <br>Enter a unique name for the <strong>Data Service Name</strong> and click on <strong>Next</strong>.<br>Then, click on <strong>Add New Datasource</strong> and enter details for your data source.<br>At the <strong>Password</strong> option, tick on checkbox <strong>Use as Secret Alias</strong>, and enter the secret alias added in <strong>cipher-text.properties</strong> file.</p><p>Now, if you click on <strong>Test Connection </strong>button, you can see the defined secret alias value is mapped and resolved for the data source configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yJdp6YTRkDutkGdOsydsOw.png" /></figure><p><strong>References</strong></p><p>[1]- <a href="https://docs.wso2.com/display/Carbon440/Encrypting+Passwords+with+Cipher+Tool#EncryptingPasswordswithCipherTool-Encryptingpasswordsmanually">https://docs.wso2.com/display/Carbon440/Encrypting+Passwords+with+Cipher+Tool#EncryptingPasswordswithCipherTool-Encryptingpasswordsmanually</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa1834b0c52a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UserIdentityManagementAdminService in WSO2 Identity Server]]></title>
            <link>https://medium.com/@prabushi/useridentitymanagementadminservice-in-wso2-identity-server-b59aea012a02?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/b59aea012a02</guid>
            <category><![CDATA[identity-server]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Fri, 16 Feb 2018 15:57:15 GMT</pubDate>
            <atom:updated>2018-02-16T16:44:04.268Z</atom:updated>
            <content:encoded><![CDATA[<p>We can use <strong>UserIdentityManagementAdminService</strong> [1] to lock/unlock user accounts without login to management console and manually locking/unlocking the account.</p><p>In addition to locking and unlocking, UserIdentityManagementAdminService supports following functionality through the admin service.</p><blockquote>1. changeUserPassword<br>2. deleteUser<br>3. disableUserAccount<br>4. getAllChallengeQuestions<br>5. getAllPromotedUserChallenge<br>6. getAllUserIdentityClaims<br>7. getChallengeQuestionsOfUser<br>8. isReadOnlyUserStore<br>9. resetUserPassword<br>10. setChallengeQuestions<br>11. setChallengeQuestionsOfUser<br>12. updateUserIdentityClaims</blockquote><p>I have used WSO2 IS 5.3.0 for following configurations.</p><p>First of all, in order to access the WSDL of the service we have to set <strong>false</strong> for <strong>HideAdminServiceWSDL</strong> at wso2is-5.3.0/repository/conf/carbon.xml. <br>&lt;HideAdminServiceWSDL&gt;false&lt;/HideAdminServiceWSDL&gt;</p><p>Enable <strong>org.wso2.carbon.user.core.listener.UserOperationEventListener</strong> at wso2is-5.3.0/repository/conf/identity/identity.xml</p><pre>&lt;EventListener type=”org.wso2.carbon.user.core.listener.UserOperationEventListener” name=”org.wso2.carbon.identity.mgt.IdentityMgtEventListener” orderId=”50&quot; enable=”true”/&gt;</pre><p>Then, start the WSO2 Identity Server.</p><p>Once the server is started, go to <a href="https://localhost:9443/services/UserIdentityManagementAdminService?wsdl">https://localhost:9443/services/UserIdentityManagementAdminService?wsdl</a> URL from a web browser. You will see the WSDL of this admin service with the details of all the available SOAP operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EbQhlj6gog5HFZTcnBIHzA.png" /></figure><p>Then you can use <strong>SOAPUI</strong> to create a SOAP project using the above URL, and invoke relevant SOAP operations (<strong>lockUserAccount</strong>/<strong>unlockUserAccount</strong>) as follows.</p><ol><li>Enable <strong>Account blocked by default</strong> by editing the <strong>http://wso2.org/claims</strong> [2].</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9bzbbpzfj8GFktQI1R3cUQ.png" /></figure><p>2. Create a new user and assign roles for that user.</p><p>3. Then, lock the user account using the<strong> lockUserAccount</strong> operation with the following payload.</p><pre>&lt;soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ser=”http://services.mgt.identity.carbon.wso2.org&quot;&gt;<br> &lt;soapenv:Header/&gt;<br> &lt;soapenv:Body&gt;<br> &lt;ser:lockUserAccount&gt;<br> &lt;ser:userName&gt;user1&lt;/ser:userName&gt;<br> &lt;/ser:lockUserAccount&gt;<br> &lt;/soapenv:Body&gt;<br>&lt;/soapenv:Envelope&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hnNp6b-4HI3bVWQL2MCZVQ.png" /><figcaption>SOAPUI Request</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*jO6l2T4YT2WvHsuvXPJnVg.png" /><figcaption>User profile at lock</figcaption></figure><p>Unlock the user account using the <strong>unlockUserAccount</strong> operation with the following payload.</p><pre>&lt;soapenv:Envelope xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ser=”http://services.mgt.identity.carbon.wso2.org&quot;&gt;<br> &lt;soapenv:Header/&gt;<br> &lt;soapenv:Body&gt;<br> &lt;ser:unlockUserAccount&gt;<br> &lt;ser:userName&gt;user1&lt;/ser:userName&gt;<br> &lt;/ser:unlockUserAccount&gt;<br> &lt;/soapenv:Body&gt;<br>&lt;/soapenv:Envelope&gt;</pre><p><strong>References</strong></p><p>[1]- <a href="https://docs.wso2.com/display/IS530/Calling+Admin+Services">https://docs.wso2.com/display/IS530/Calling+Admin+Services</a><br>[2]- <a href="https://docs.wso2.com/display/IS530/Locking+a+Specific+User+Account">https://docs.wso2.com/display/IS530/Locking+a+Specific+User+Account</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b59aea012a02" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Avoid “Error occurred while applying patches” with WSO2 ESB 4.8.1]]></title>
            <link>https://medium.com/@prabushi/avoid-error-occurred-while-applying-patches-with-wso2-esb-4-8-1-51610b059320?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/51610b059320</guid>
            <category><![CDATA[esb]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Thu, 15 Feb 2018 05:34:34 GMT</pubDate>
            <atom:updated>2018-02-15T05:36:07.925Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometime we get the following error when we start WSO2 ESB 4.8.1 using java 1.7 or 1.6.</p><pre>JAVA_HOME environment variable is set to /usr/lib/jvm/java-7-oracle<br>CARBON_HOME environment variable is set to ..../wso2esb-4.8.1<br>[2018-02-12 10:29:00,827]  INFO {org.wso2.carbon.server.extensions.PatchInstaller} -  Patch changes detected <br>[2018-02-12 10:29:01,706] ERROR {org.wso2.carbon.server.extensions.PatchInstaller} -  Error occurred while applying patches<br>java.io.IOException: Destination &#39;..../wso2esb-4.8.1/repository/components/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20120522-1813&#39; exists but is a directory<br> at org.wso2.carbon.server.util.FileUtils.copyFile(FileUtils.java:145)<br> at org.wso2.carbon.server.util.PatchUtils.copyNewPatches(PatchUtils.java:211)<br> at org.wso2.carbon.server.extensions.PatchInstaller.perform(PatchInstaller.java:80)<br> at org.wso2.carbon.server.Main.invokeExtensions(Main.java:152)<br> at org.wso2.carbon.server.Main.main(Main.java:94)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br> at java.lang.reflect.Method.invoke(Method.java:606)<br> at org.wso2.carbon.bootstrap.Bootstrap.loadClass(Bootstrap.java:63)<br> at org.wso2.carbon.bootstrap.Bootstrap.main(Bootstrap.java:45)</pre><p>In order to avoid this error, we have to copy</p><p>…/wso2esb-4.8.1/lib/org.wso2.carbon.server-4.2.0.jar to</p><p>…/wso2esb-4.8.1/repository/components/patches/patch0001/ directory</p><p>before starting the server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51610b059320" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analyse a thread dump with process information]]></title>
            <link>https://medium.com/@prabushi/analyse-thread-dump-with-process-instructions-c5490b97e2d1?source=rss-9fe06995ea54------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5490b97e2d1</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[prabushi samarakoon]]></dc:creator>
            <pubDate>Sun, 11 Feb 2018 11:00:09 GMT</pubDate>
            <atom:updated>2018-02-11T11:01:07.072Z</atom:updated>
            <content:encoded><![CDATA[<p>Analysis on thread dumps are very important to identify the spinning threads that has utilized more CPU cycles. Also, the identified thread traces can be used to identify possible code level areas that has caused this behaviour.</p><p>We can use following command to retrieve the thread dump. “pid” is the process id of the running VM.</p><p>jstack &lt;pid&gt; &gt; thread-dump.txt</p><p>Following command is used to retrieve the process information.</p><p>ps -C java -L -o pcpu,cpu,nice,state,cputime,pid,tid &gt; thread-usage.txt</p><p>Proccesing information contains the following information.</p><pre>%CPU CPU  NI S     TIME   PID   TID<br> 0.0   -   0 S 00:00:00  2492  2492<br> 0.0   -   0 S 00:00:03  2492  2493<br> 0.2   -   0 S 02:18:30  2492  2494<br> 0.1   -   0 S 01:20:54  2492  2542<br>39.2   -   0 R 15-09:43:49 2492 2569</pre><p><strong>%CPU- </strong>Percentage of CPU utilization (this is the percentage with in the corresponding process, ei: 100% is the the process’s CPU utilization. And there will be multiples processes with in a system at a particular time)<br><strong>NI- </strong>Nice value of the task<br><strong>S- </strong>Thread state(R-Running, S-Sleeping, D-Uninterruptible sleep, T- Stopped by job control signal, Z — Zombie)<br><strong>TIME- </strong>Total CPU time used by the task from it’s start<br><strong>PID- </strong>Process identfier in decimal<br><strong>TID-</strong> Thread identifier in decimal</p><p>Thread dump consists of all the stack traces of the treads that are used by the relevant process ID.</p><pre>2018-01-03 18:15:53<br>Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode):<br></pre><pre>&quot;RMI TCP Connection(idle)&quot; daemon prio=10 tid=0x00007fbf6c005800 nid=0x2be0 waiting on condition [0x00007fbf593d2000]<br>   java.lang.Thread.State: TIMED_WAITING (parking)<br> at sun.misc.Unsafe.park(Native Method)<br> - parking to wait for  &lt;0x00000000c010aca0&gt; (a java.util.concurrent.SynchronousQueue$TransferStack)<br> at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)<br> at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460)<br> at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359)<br> at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942)<br> at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)<br> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)<br> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)<br> at java.lang.Thread.run(Thread.java:745)<br></pre><pre>&quot;PassThroughMessageProcessor-35&quot; prio=10 tid=0x00007fbf9019b000 nid=0x2b44 waiting on condition [0x00007fbf580bf000]<br>   java.lang.Thread.State: WAITING (parking)<br> at sun.misc.Unsafe.park(Native Method)<br> - parking to wait for  &lt;0x00000000c33c6520&gt; (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)<br> at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)<br> at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)</pre><p><strong>Thread name</strong> ( Eg: PassThroughMessageProcessor-35 of the above trace” )<br><strong>Priority</strong> ( Eg: prio=10 )<br><strong>Thread identifier</strong> (Eg: tid=0x00007fbf9019b000 )<br><strong>Native thread identifier</strong> ( Eg: nid=0x2b44 )<br><strong>JVM data structure address</strong> ( Eg: 0x00007fbf580bf000 )<br><strong>Thread state</strong> ( Eg: WAITING (parking) )</p><p>By looking at the CPU usages from the <strong>thread-usage.txt</strong>, we can identify the threads that have most of the CPU consumption percentages. For example, 39.2–0 R 15–09:43:49 2492 2569 entry has the highest percentage according to above example.</p><p>Here, the related <strong>thread ID is 2569</strong> which is defined in <strong>decimal</strong> format. However, the thread IDs in the thread dump are defined in <strong>hexadecimal</strong> values.</p><p>Therefore, we have to convert 2569 to decimal. After converting, we get the corresponding hexadecimal value as “a09”.</p><p>Then, we can find the relevant thread trace by searching for “nid=0xa09” within the thread dump. Here, <strong>nid</strong> refers to the native thread ID.</p><p>By looking at the stack trace of that thread at thread dump, we can identify the relevant code level position that has caused the issue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5490b97e2d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>