<?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 Megala Uthayakumar on Medium]]></title>
        <description><![CDATA[Stories by Megala Uthayakumar on Medium]]></description>
        <link>https://medium.com/@megala.11?source=rss-76e9e818d3bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*lqib6eYMLt7BjHgv.</url>
            <title>Stories by Megala Uthayakumar on Medium</title>
            <link>https://medium.com/@megala.11?source=rss-76e9e818d3bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 16:13:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@megala.11/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[[Tutorial] How to connect to a soap backend that implements WS-RM using WSO2 EI 6.3.0?]]></title>
            <link>https://medium.com/@megala.11/tutorial-how-to-connect-to-a-soap-backend-that-implements-ws-rm-using-wso2-ei-6-3-0-153066f51ae3?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/153066f51ae3</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[rmws]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Thu, 16 Aug 2018 09:24:31 GMT</pubDate>
            <atom:updated>2018-10-22T06:06:49.382Z</atom:updated>
            <content:encoded><![CDATA[<h3>Step 1</h3><p>Get a WUM updated pack of WSO2 EI 6.3.0. If you are new to WUM, please refer <a href="https://wso2.com/updates/wum">this</a>.</p><h3>Step 2</h3><p>To connect to the soap backend that is implementing WS-RM, WSO2 provides a connector named <strong>reliablemessage</strong>. Download the connector from wso2 store <a href="https://store.wso2.com/store/assets/esbconnector/details/b152e282-8c4a-4fee-8781-439fc4a0d9b9">here</a>.</p><h3>Step 3</h3><p>Before uploading this connector to EI, it is required to install <strong>WSO2 Carbon — CXF WS Reliable Messaging Feature. </strong>To install this, copy the following pom.xml and wso2-ei-6.3.0 on same directory.</p><p>The directory structure should look like follow,</p><pre><strong>Directory</strong></pre><pre><strong>|-pom.xml</strong></pre><pre><strong>|-wso2ei-6.3.0</strong></pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/27bc5b1dedb0574b54e612b873d8c7e4/href">https://medium.com/media/27bc5b1dedb0574b54e612b873d8c7e4/href</a></iframe><p>Execute mvn clean install on the same directory to install the feature.</p><h4>Step 4</h4><p>Create a folder named cxf in wso2ei-6.3.0/conf location. Copy the following file(i.e. client.xml) in wso2ei-6.3.0/conf/cxf folder. This is the CXF bus configuration to be used by the client.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73b6e574a89bc912486aa0d3446d9116/href">https://medium.com/media/73b6e574a89bc912486aa0d3446d9116/href</a></iframe><p><strong>Step 5</strong></p><p>Start the EI and upload the connector by visiting the management console. After uploading the connector enable it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2IoDQLDIyTiWJbePXJOFbw.png" /></figure><p><strong>Step 5</strong></p><p>Download the <a href="https://github.com/wso2-extensions/esb-connector-reliablemessage/raw/master/src/test/resources/rmserver/rm_server.jar">rm_server.jar </a>and run it with <strong>java -jar rm_server.jar</strong>. This is a simple server that hosts a soap service which implements WS-RM.</p><p><strong>Step 6</strong></p><p>Create a proxy service by copying the following file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/441f6bcc60248e2ae6d5ea017776527e/href">https://medium.com/media/441f6bcc60248e2ae6d5ea017776527e/href</a></iframe><p>to &lt;EI_HOME&gt;/repository/deployment/server/synapse-configs/default/proxy-services directory.</p><p><strong>Step 7</strong></p><p>Call the relevant proxy-service with following payload from postman.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>&quot;<br>                   xmlns:xs=&quot;<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&quot;<br>                   xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot;&gt;<br>    &lt;SOAP-ENV:Body&gt;<br>        &lt;ns4:greetMe xmlns:ns4=&quot;<a href="http://cxf.apache.org/hello_world_soap_http/types">http://cxf.apache.org/hello_world_soap_http/types</a>&quot;&gt;<br>            &lt;ns4:requestType&gt;Megala&lt;/ns4:requestType&gt;<br>        &lt;/ns4:greetMe&gt;<br>    &lt;/SOAP-ENV:Body&gt;<br>&lt;/SOAP-ENV:Envelope&gt;</pre><p>We could see following sequence of messages,</p><pre>[2018-08-16 13:48:51,958] [EI-Core]  INFO - BusApplicationContext Loaded configuration file file:/home/megala/RRT/Pack/wso2ei-6.3.0/conf/cxf/client.xml.</pre><pre>[2018-08-16 13:48:52,002] [EI-Core]  INFO - ReflectionServiceFactoryBean Creating Service {http://cxf.apache.org/hello_world_soap_http}GreeterService from class org.apache.cxf.jaxws.support.DummyImpl</pre><pre>[2018-08-16 13:48:52,060] [EI-Core]  WARN - RMEndpoint MBeanServer not available.</pre><pre>[2018-08-16 13:48:52,061] [EI-Core]  INFO - Proxy Sending out-of-band RM protocol message {http://schemas.xmlsoap.org/ws/2005/02/rm}CreateSequence.</pre><pre>[2018-08-16 13:48:52,064] [EI-Core]  INFO - SequenceAbstractPortType Outbound Message</pre><pre>---------------------------</pre><pre>ID: 13</pre><pre>Address: http://localhost:9010/SoapContext/GreeterPort</pre><pre>Encoding: UTF-8</pre><pre>Http-Method: POST</pre><pre>Content-Type: text/xml</pre><pre>Headers: {Accept=[*/*], SOAPAction=[&quot;http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence&quot;]}</pre><pre>Payload: &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Header&gt;&lt;Action xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence&lt;/Action&gt;&lt;MessageID xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:74e5ad9e-00c1-4cf4-b08c-669aa3b58eff&lt;/MessageID&gt;&lt;To xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://localhost:9010/SoapContext/GreeterPort&lt;/To&gt;&lt;ReplyTo xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;&lt;Address&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/Address&gt;&lt;/ReplyTo&gt;&lt;/soap:Header&gt;&lt;soap:Body&gt;&lt;CreateSequence xmlns=&quot;http://schemas.xmlsoap.org/ws/2005/02/rm&quot; xmlns:ns2=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;&lt;AcksTo&gt;&lt;ns2:Address&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/ns2:Address&gt;&lt;/AcksTo&gt;&lt;Expires&gt;PT0S&lt;/Expires&gt;&lt;Offer&gt;&lt;Identifier&gt;urn:uuid:8c337d79-d6d6-4f7b-8ed2-e72e80f5eee0&lt;/Identifier&gt;&lt;Expires&gt;PT0S&lt;/Expires&gt;&lt;/Offer&gt;&lt;/CreateSequence&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;</pre><pre>--------------------------------------</pre><pre>[2018-08-16 13:48:52,076] [EI-Core]  INFO - SequenceAbstractPortType Inbound Message</pre><pre>----------------------------</pre><pre>ID: 13</pre><pre>Response-Code: 200</pre><pre>Encoding: UTF-8</pre><pre>Content-Type: text/xml;charset=UTF-8</pre><pre>Headers: {content-type=[text/xml;charset=UTF-8], Server=[Jetty(8.y.z-SNAPSHOT)], transfer-encoding=[chunked]}</pre><pre>Payload: &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Header&gt;&lt;Action xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse&lt;/Action&gt;&lt;MessageID xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:68606bd4-4da7-44cf-a9fb-e711bb9dd296&lt;/MessageID&gt;&lt;To xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/To&gt;&lt;RelatesTo xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:74e5ad9e-00c1-4cf4-b08c-669aa3b58eff&lt;/RelatesTo&gt;&lt;/soap:Header&gt;&lt;soap:Body&gt;&lt;CreateSequenceResponse xmlns=&quot;http://schemas.xmlsoap.org/ws/2005/02/rm&quot; xmlns:ns2=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;&lt;Identifier&gt;urn:uuid:c72907be-7675-41b7-976e-3ef732cdca03&lt;/Identifier&gt;&lt;Expires&gt;P0Y0M0DT0H0M0S&lt;/Expires&gt;&lt;Accept&gt;&lt;AcksTo&gt;&lt;ns2:Address&gt;http://localhost:9010/SoapContext/GreeterPort&lt;/ns2:Address&gt;&lt;/AcksTo&gt;&lt;/Accept&gt;&lt;/CreateSequenceResponse&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;</pre><pre>--------------------------------------</pre><pre>[2018-08-16 13:48:52,081] [EI-Core]  INFO - RMSoapInInterceptor Updating service model info in exchange</pre><pre>[2018-08-16 13:48:52,086] [EI-Core]  INFO - RMManager Setting retransmit chain from message</pre><pre>[2018-08-16 13:48:52,089] [EI-Core]  INFO - RMCaptureOutInterceptor$CaptureEnd Captured message 1 in sequence urn:uuid:c72907be-7675-41b7-976e-3ef732cdca03</pre><pre>[2018-08-16 13:48:52,094] [EI-Core]  INFO - DummyImpl Outbound Message</pre><pre>---------------------------</pre><pre>ID: 14</pre><pre>Address: http://localhost:9010/SoapContext/GreeterPort</pre><pre>Encoding: UTF-8</pre><pre>Http-Method: POST</pre><pre>Content-Type: text/xml</pre><pre>Headers: {Accept=[*/*], SOAPAction=[&quot;&quot;]}</pre><pre>Payload: &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;&lt;soap:Header&gt;&lt;Action xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://cxf.apache.org/jaxws/dispatch/DummyImpl/InvokeRequest&lt;/Action&gt;&lt;MessageID xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:fab84de9-0008-4a4e-8a3e-11cbbc0148af&lt;/MessageID&gt;&lt;To xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://localhost:9010/SoapContext/GreeterPort&lt;/To&gt;&lt;ReplyTo xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;&lt;Address&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/Address&gt;&lt;/ReplyTo&gt;&lt;wsrm:Sequence xmlns:ns2=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot; xmlns:wsrm=&quot;http://schemas.xmlsoap.org/ws/2005/02/rm&quot; soap:mustUnderstand=&quot;1&quot;&gt;&lt;wsrm:Identifier&gt;urn:uuid:c72907be-7675-41b7-976e-3ef732cdca03&lt;/wsrm:Identifier&gt;&lt;wsrm:MessageNumber&gt;1&lt;/wsrm:MessageNumber&gt;&lt;/wsrm:Sequence&gt;&lt;/soap:Header&gt;&lt;soap:Body&gt;</pre><pre>&lt;ns4:greetMe xmlns:ns4=&quot;http://cxf.apache.org/hello_world_soap_http/types&quot;&gt;</pre><pre>&lt;ns4:requestType&gt;Megala&lt;/ns4:requestType&gt;</pre><pre>&lt;/ns4:greetMe&gt;</pre><pre>&lt;/soap:Body&gt;</pre><pre>&lt;/soap:Envelope&gt;</pre><pre>--------------------------------------</pre><pre>[2018-08-16 13:48:52,109] [EI-Core]  INFO - DummyImpl Inbound Message</pre><pre>----------------------------</pre><pre>ID: 14</pre><pre>Response-Code: 200</pre><pre>Encoding: UTF-8</pre><pre>Content-Type: text/xml;charset=UTF-8</pre><pre>Headers: {content-type=[text/xml;charset=UTF-8], Server=[Jetty(8.y.z-SNAPSHOT)], transfer-encoding=[chunked]}</pre><pre>Payload: &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Header&gt;&lt;Action xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://cxf.apache.org/hello_world_soap_http/Greeter/greetMeResponse&lt;/Action&gt;&lt;MessageID xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:dc80ccec-35b6-48ed-97dd-5c5f271fa0fd&lt;/MessageID&gt;&lt;To xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/To&gt;&lt;RelatesTo xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:fab84de9-0008-4a4e-8a3e-11cbbc0148af&lt;/RelatesTo&gt;&lt;wsrm:Sequence soap:mustUnderstand=&quot;1&quot; xmlns:ns2=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot; xmlns:wsrm=&quot;http://schemas.xmlsoap.org/ws/2005/02/rm&quot;&gt;&lt;wsrm:Identifier&gt;urn:uuid:8c337d79-d6d6-4f7b-8ed2-e72e80f5eee0&lt;/wsrm:Identifier&gt;&lt;wsrm:MessageNumber&gt;1&lt;/wsrm:MessageNumber&gt;&lt;/wsrm:Sequence&gt;&lt;/soap:Header&gt;&lt;soap:Body&gt;&lt;greetMeResponse xmlns=&quot;http://cxf.apache.org/hello_world_soap_http/types&quot;&gt;&lt;responseType&gt;Hello Megala&lt;/responseType&gt;&lt;/greetMeResponse&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;</pre><pre>--------------------------------------</pre><pre>[2018-08-16 13:48:52,115] [EI-Core]  INFO - Proxy Sending out-of-band RM protocol message {http://schemas.xmlsoap.org/ws/2005/02/rm}CloseSequence.</pre><pre>[2018-08-16 13:48:52,120] [EI-Core]  INFO - SequenceAbstractPortType Outbound Message</pre><pre>---------------------------</pre><pre>ID: 15</pre><pre>Address: http://localhost:9010/SoapContext/GreeterPort</pre><pre>Encoding: UTF-8</pre><pre>Http-Method: POST</pre><pre>Content-Type: text/xml</pre><pre>Headers: {Accept=[*/*], SOAPAction=[&quot;http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage&quot;]}</pre><pre>Payload: &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Header&gt;&lt;Action xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2005/02/rm/LastMessage&lt;/Action&gt;&lt;MessageID xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:d0846f4d-ba73-4636-9eba-cfc400555290&lt;/MessageID&gt;&lt;To xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://localhost:9010/SoapContext/GreeterPort&lt;/To&gt;&lt;wsrm:Sequence soap:mustUnderstand=&quot;1&quot; xmlns:ns2=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot; xmlns:wsrm=&quot;http://schemas.xmlsoap.org/ws/2005/02/rm&quot;&gt;&lt;wsrm:Identifier&gt;urn:uuid:c72907be-7675-41b7-976e-3ef732cdca03&lt;/wsrm:Identifier&gt;&lt;wsrm:MessageNumber&gt;2&lt;/wsrm:MessageNumber&gt;&lt;wsrm:LastMessage/&gt;&lt;/wsrm:Sequence&gt;&lt;/soap:Header&gt;&lt;soap:Body/&gt;&lt;/soap:Envelope&gt;</pre><pre>--------------------------------------</pre><pre>[2018-08-16 13:48:52,130] [EI-Core]  INFO - SequenceAbstractPortType Inbound Message</pre><pre>----------------------------</pre><pre>ID: 15</pre><pre>Response-Code: 200</pre><pre>Encoding: UTF-8</pre><pre>Content-Type: text/xml;charset=UTF-8</pre><pre>Headers: {content-type=[text/xml;charset=UTF-8], Server=[Jetty(8.y.z-SNAPSHOT)], transfer-encoding=[chunked]}</pre><pre>Payload: &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Header&gt;&lt;Action xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement&lt;/Action&gt;&lt;MessageID xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:fb41181e-f329-44d7-adf7-c605d23d85ef&lt;/MessageID&gt;&lt;To xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/To&gt;&lt;RelatesTo xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://www.w3.org/2005/08/addressing/unspecified&lt;/RelatesTo&gt;&lt;wsrm:SequenceAcknowledgement xmlns:ns2=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot; xmlns:wsrm=&quot;http://schemas.xmlsoap.org/ws/2005/02/rm&quot;&gt;&lt;wsrm:Identifier&gt;urn:uuid:c72907be-7675-41b7-976e-3ef732cdca03&lt;/wsrm:Identifier&gt;&lt;wsrm:AcknowledgementRange Lower=&quot;1&quot; Upper=&quot;2&quot;/&gt;&lt;/wsrm:SequenceAcknowledgement&gt;&lt;/soap:Header&gt;&lt;soap:Body/&gt;&lt;/soap:Envelope&gt;</pre><pre>--------------------------------------</pre><pre>[2018-08-16 13:48:52,141] [EI-Core]  INFO - RMSoapInInterceptor Updating service model info in exchange</pre><pre>[2018-08-16 13:48:52,142] [EI-Core]  INFO - Proxy Sending out-of-band RM protocol message {http://schemas.xmlsoap.org/ws/2005/02/rm}TerminateSequence.</pre><pre>[2018-08-16 13:48:52,147] [EI-Core]  INFO - SequenceAbstractPortType Outbound Message</pre><pre>---------------------------</pre><pre>ID: 16</pre><pre>Address: http://localhost:9010/SoapContext/GreeterPort</pre><pre>Encoding: UTF-8</pre><pre>Http-Method: POST</pre><pre>Content-Type: text/xml</pre><pre>Headers: {Accept=[*/*], SOAPAction=[&quot;http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence&quot;]}</pre><pre>Payload: &lt;soap:Envelope xmlns:soap=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;soap:Header&gt;&lt;Action xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence&lt;/Action&gt;&lt;MessageID xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;urn:uuid:a75e82cc-4689-44f6-b172-90cf653ddf68&lt;/MessageID&gt;&lt;To xmlns=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;http://localhost:9010/SoapContext/GreeterPort&lt;/To&gt;&lt;/soap:Header&gt;&lt;soap:Body&gt;&lt;TerminateSequence xmlns=&quot;http://schemas.xmlsoap.org/ws/2005/02/rm&quot; xmlns:ns2=&quot;http://schemas.xmlsoap.org/ws/2004/08/addressing&quot;&gt;&lt;Identifier&gt;urn:uuid:c72907be-7675-41b7-976e-3ef732cdca03&lt;/Identifier&gt;&lt;/TerminateSequence&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;</pre><p>With these messages, we could see the handshake between the service that implements WS-RM and client has been happening successfully and from the postman side we could see following response. Here series of handshake is handled by EI itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQlUo7IASkxMB7teLcBf5w.png" /></figure><h3>References</h3><ul><li><a href="https://docs.wso2.com/display/EI630/WSO2+Enterprise+Integrator+Documentation">WSO2 Enterprise Integrator Documentation - Enterprise Integrator Documentation - WSO2 Documentation</a></li><li><a href="https://wso2.com/updates/wum">WUM</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=153066f51ae3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling custom claims in Self Contained Access token with JWT Bearer Grant type in WSO2 IS 5.5.0]]></title>
            <link>https://medium.com/@megala.11/handling-custom-claims-in-self-contained-access-token-with-jwt-bearer-grant-type-in-wso2-is-5-5-0-fc89df66d150?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc89df66d150</guid>
            <category><![CDATA[wso2-identity-server]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[identity]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Sat, 09 Jun 2018 04:37:30 GMT</pubDate>
            <atom:updated>2018-06-09T04:37:30.327Z</atom:updated>
            <content:encoded><![CDATA[<p>IS 5.5.0 WUM updated pack, provides the capability to handle custom claims with JWT bearer grant type. In this blog, we will be looking into how can we handle the custom claims in different ways.</p><p>To demonstrate this functionality, we will be using two instances of identity server, of which will act as a federated identity provider for other identity server. Let’s call identity server acting as Identity provider as IS-IP and other one as IS-SP</p><h3>Configure IS-IP and IS-SP</h3><p>Generate a <a href="https://docs.wso2.com/display/IS550/Self-contained+Access+Tokens">self contained access token</a> using the IS-IP by using password grant type by passing the scope as openid. Make sure to fill the user profile of the user with relevant claims.</p><pre>curl -u q4h7UhUyt0wC8A2Awu_kfmxEpr0a:vlTwUeCAyYPRzkeayJpmdW0xfxAa -k -d “grant_type=password&amp;username=megala&amp;password=megala” -H “Content-Type:application/x-www-form-urlencoded” <a href="https://localhost:9444/oauth2/token?scope=openid">https://localhost:9444/oauth2/token?scope=openid</a></pre><p>Following is the JWT token received,</p><pre>eyJ4NXQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJraWQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJhbGciOiJSUzI1NiJ9.eyJjb3VudHJ5IjoiU3JpIExhbmthIiwic3ViIjoibWVnYWxhQGNhcmJvbi5zdXBlciIsImF1ZCI6WyJxNGg3VWhVeXQwd0M4QTJBd3Vfa2ZteEVwcjBhIl0sImF6cCI6InE0aDdVaFV5dDB3QzhBMkF3dV9rZm14RXByMGEiLCJzY29wZSI6Im9wZW5pZCIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTQ0NFwvb2F1dGgyXC90b2tlbiIsImV4cCI6MTUyODA5ODE1OCwiaWF0IjoxNTI4MDk0NTU4LCJlbWFpbCI6Im1lZ2FsYUB3c28yLmNvbSIsImp0aSI6IjIyMjMyNDZhLWI5MmUtNDMwNC1iYmY1LTE3MzExNTU3Y2FmNSJ9.c-WKt87FL24WAy24E2mp2uusPJAR2aDZDujqKkVlM5yDjUQ9hYvDX96KTo4ew1j9LGIb8cN9npX5NK-DtLeNHNuR1ypKhcyQ9Gwsqp42wEswH_IMHVRxERv5X0giz8rH-z7LGo2IGmGjLjhfGXP9C-_1r00krtkCTZpWPmUTW1BneFEEVF-WLaNmjC28CUdTcVealZOD9ByA44WTiA-nUmAp2j1zWb7K-rDm0cMaJ_ucYsnObmDovKyT-7y02zutBNm5plfn2cQbsLo0cAzWmTtdpX5gXmqtJHANRXwM8LriVJMTG7nDU5zDcU4GRYz5aWPQn3RgTA4donzpPvPYQw</pre><p>When decoded, payload of the above JWT token looks like follow,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*I6wo6NErDjfdEYigrtgGFA.png" /></figure><p>In the above <strong>country</strong> and <strong>email</strong> are custom claims related with the particular user.</p><p>In the IS-SP, configure the IS-IP as the identity provider as mentioned <a href="https://docs.wso2.com/display/ISCONNECTORS/Configuring+JWT+Grant+Type#ConfiguringJWTGrantType-ConfiguretheJWTgranttype">here</a>. Identity provider configuration of local looks looks like follow, based on the values extracted from above JWT token (i.e. Identity provider name and issuer value of the JWT token need to match, azp value of JWT token need to match with alias value).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uUeFNBEJFc1m5uHc" /></figure><h3>Call token endpoint with JWT bearer grant type</h3><h3>Scenario 1</h3><p>“<strong>ConvertToOIDCDialect</strong>” element false in identity.xml under “<strong>OpenIDConnect</strong>” (i.e. Default configuration)</p><pre>curl -i -X POST -u EcvBCz8CDWFdALzavlakTTKkSPUa:LpElcqthcTOqilN1K_zAHf48fL4a -k -d ‘grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer&amp;assertion=&lt;jwt_assertion&gt;’ -H ‘Content-Type: application/x-www-form-urlencoded’ <a href="https://localhost:9443/oauth2/token?scope=openid">https://localhost:9443/oauth2/token?scope=openid</a></pre><p>Following is the payload after decoding the JWT token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*3EgXNc_11VvnBEUknJ2skA.png" /></figure><p>Since “<strong>ConverToOIDCDialect</strong>” is false, all the custom claims coming from incoming JWT assertion are directly copied to the generated JWT token. “<strong>country</strong>” and “<strong>email</strong>” are copied directly to the JWT token generated.</p><h3>Scenario 2</h3><p>“<strong>ConvertToOIDCDialect</strong>” element set to true and “<strong>AddUnmappedUserAttributes</strong>” set to false in identity.xml under “<strong>OpenIDConnect</strong>”.</p><p><strong>Sub-Scenario 1 — IDP claim mappings and SP requested claims are empty</strong></p><p>This will also behave as the scenario 1, in the instance of missing claim mapping in IDP level and SP level, all the custom claims will be directly copied.</p><p>Decoded payload for this scenario looks like follow,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*j4VBYVQ7CUoi9Y35BNfRMA.png" /></figure><p><strong>Sub-Scenario 2 — IDP claim mapping exist, but SP requested claim mapping does not exist</strong></p><p>This is considered as user configuration error from IS point of view. In this situation, no any custom claims will be passed with the self contained access token.</p><p>Following is the decoded payload for this scenario,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*6j5LsWX0fklGv2vKThtPHA.png" /></figure><p><strong>Sub-Scenario 3 — IDP Claim mappings and SP requested claim exist</strong></p><p>All the incoming claims will go through the mapping process and filtered according to scopes and the relevant claims will send back with the self contained token.</p><p>In my local setup, I have mapped local claim “<a href="http://wso2.org/claims/country"><strong>http://wso2.org/claims/country</strong></a><strong>” </strong>to “<strong>customclaim</strong>” in OIDC dialect as follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rePpUHlKi-51_rA2" /></figure><p>Added customclaim to openid scope,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GHkypccMfuEajrHX" /></figure><p>Added following IDP mapping,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5mHV8JSdCGzx6jae" /></figure><p>Added following SP requested claims,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Mj_yI6_x9lj1Oq6y" /></figure><p>Decoded payload for this scenario looks like follow,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*6_C7aCPnHSMOa6WGI9mNYQ.png" /></figure><p>“<strong>customclaim</strong>” was added based on the claim mapping in IDP and SP level, and based on the OIDC claim mapping configurations. Since “<strong>email</strong>” does not have any claim mapping in IDP level, it has not been added to the generated token.</p><h3>Scenario 3</h3><p><strong>“ConvertToOIDCDialect” </strong>element set to true and<strong> “AddUnmappedUserAttributes” </strong>set to true in identity.xml under <strong>“OpenIDConnect” </strong>element.</p><p>The configurations are similar to Scenario 1 — Sub-Scenario 3,</p><p>Decoded payload for this scenario looks like follow,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*hH8KizUw32pmNmi-wr03mw.png" /></figure><p>Incoming JWT contained <strong>“country”</strong> and <strong>“email”</strong> as custom claims. <strong>“country” </strong>has claim mappings, hence it was converted to <strong>“customclaim”</strong> and <strong>“email”</strong> does not have a claim mapping, hence it was directly copied to generated token .</p><h3><strong>References</strong></h3><ul><li><a href="https://docs.wso2.com/display/IS550/Self-contained+Access+Tokens">Self-contained Access Tokens - Identity Server 5.5.0 - WSO2 Documentation</a></li><li><a href="https://docs.wso2.com/display/ISCONNECTORS/Configuring+JWT+Grant+Type#ConfiguringJWTGrantType-ConfiguretheJWTgranttype">Configuring JWT Grant Type</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc89df66d150" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to pass the Content-Length header to back-end from a proxy service or an API?]]></title>
            <link>https://medium.com/@megala.11/how-to-pass-the-content-length-header-to-back-end-from-a-proxy-service-or-an-api-dc5b00e06323?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc5b00e06323</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[wso2-api-manager]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Sun, 27 May 2018 14:47:57 GMT</pubDate>
            <atom:updated>2018-05-27T14:47:57.681Z</atom:updated>
            <content:encoded><![CDATA[<p>In WSO2 API Manager and Enterprise Integrator, when passing a request to back-end “Transfer-Encoding” header will be passed. However there may be a scenario, where the back-end expects a “Content-Length” header, instead of “Transfer-Encoding” header. In that scenario, we have two options to fulfill this requirement,</p><p><strong>Option 1</strong></p><p>Adding following two properties in your proxy/API synapse definition before sending it to the back-end,</p><pre>&lt;property name=”FORCE_HTTP_CONTENT_LENGTH” value=”true” scope=”axis2&quot;/&gt;<br>&lt;property name=”COPY_CONTENT_LENGTH_FROM_INCOMING” value=”true” scope=”axis2&quot;/&gt;</pre><p>When we add these two properties, internally in synapse level, content-length will be picked up from the incoming request and it will be directly copied to outgoing request.</p><p><strong>Option 2</strong></p><p>Adding following property in your proxy/API synapse definition before sending it to the back-end,</p><pre>&lt;property name=”DISABLE_CHUNKING” value=”true” scope=”axis2&quot; /&gt;</pre><p>When we add this property, synapse engine will try to build the message and create a content length header based on that.</p><p>Option 1 is recommended for pass-through scenarios where the incoming request contains a “Content-length” header. Further when having a larger payload it is better to go with option 1, since building a large message has its own performance implications.</p><ul><li><a href="https://wso2.com/api-management/">The #1 open-source platform for building and managing APIs with ease</a></li><li><a href="https://wso2.com/integration">Integration - On-Premise and in the Cloud</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc5b00e06323" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to call a Data Service operation with in-clause from WSO2 EI]]></title>
            <link>https://medium.com/@megala.11/how-to-call-a-data-service-operation-with-in-clause-from-wso2-ei-c12f4b91edf8?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c12f4b91edf8</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[wso2-ei]]></category>
            <category><![CDATA[wso2-dss]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Fri, 20 Apr 2018 06:15:42 GMT</pubDate>
            <atom:updated>2018-04-20T06:15:42.239Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 DSS is shipped with many pre-build samples. I have used RDBMS sample, to showcase this use case. In this sample, we have an operation called setSalaryForEmployees. This operation can be called to update the salary of set of employees.</p><pre>&lt;query id=&quot;setSalaryForEmployeesQuery&quot; useConfig=&quot;default&quot;&gt;<br>     &lt;sql&gt;update Employees set salary=:salary where employeeNumber in (:employeeNumbers)&lt;/sql&gt;<br>     &lt;param name=&quot;salary&quot; ordinal=&quot;1&quot; paramType=&quot;SCALAR&quot;  sqlType=&quot;DOUBLE&quot; type=&quot;IN&quot;/&gt;<br>      &lt;param name=&quot;employeeNumbers&quot; ordinal=&quot;2&quot; paramType=&quot;ARRAY&quot; sqlType=&quot;INTEGER&quot; type=&quot;IN&quot;/&gt;<br>&lt;/query&gt;</pre><p>This particular query includes in clause. In this blog, I will be presenting two solutions to call this particular operation from EI.</p><h4>Solution 1</h4><p>For the solution 1, we have created an API resource with <strong>POST</strong> method and the relevant list of employeeNumbers are passed in the request body in the following format,</p><pre>&lt;uniqename&gt;<br>    &lt;value&gt;111&lt;/value&gt;<br>    &lt;value&gt;112&lt;/value&gt;<br>&lt;/uniqename&gt;</pre><p>In API level, we can use xslt mediator as follow to convert this to the format expected by the DSS,</p><pre>&lt;localEntry xmlns=&quot;http://ws.apache.org/ns/synapse&quot; key=&quot;test_xslt&quot;&gt;<br>   &lt;xsl:stylesheet xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;<br> xmlns:p=&quot;http://ws.wso2.org/dataservice/samples/rdbms_sample&quot;<br> version=&quot;1.0&quot;&gt;<br>   &lt;xsl:output indent=&quot;yes&quot; method=&quot;xml&quot; omit-xml-declaration=&quot;yes&quot;/&gt;<br>     &lt;xsl:template match=&quot;*&quot;&gt;<br>        &lt;p:setSalaryForEmployees&gt;<br>          &lt;p:salary&gt;20000&lt;/p:salary&gt;<br>          &lt;xsl:for-each select=&quot;/uniqename/value&quot;&gt;<br>            &lt;p:employeeNumbers&gt;&lt;xsl:value-of select=&quot;.&quot;/&gt;           &lt;/p:employeeNumbers&gt;<br>          &lt;/xsl:for-each&gt;<br>        &lt;/p:setSalaryForEmployees&gt;<br>      &lt;/xsl:template&gt;<br>    &lt;/xsl:stylesheet&gt;<br>&lt;/localEntry&gt;</pre><h4>Solution 2</h4><p>In this second approach we are using <strong>GET</strong> API resource and relevant employee numbers will be passed in the URL with the space separated format as follow,</p><pre><a href="http://localhost:8281/api/test/20000/111">http://localhost:8281/api/test/20000/111</a> 112</pre><p>Resource definition is follow,</p><pre>&lt;resource methods=&quot;GET&quot; protocol=&quot;http&quot; uri-template=&quot;/test/{salary}/{uniqname}&quot;&gt;</pre><p>In the API level, we can use a script mediator to convert this to the expected format of DSS as follow,</p><pre>&lt;script language=&quot;js&quot;&gt;<br>   &lt;![CDATA[<br>     var property = mc.getProperty(&quot;uniqname&quot;);<br>     var salary = mc.getProperty(&quot;uri.var.salary&quot;);<br>     var properties = property.split(&quot; &quot;);<br>     var clientvarPayload = &lt;p:setSalaryForEmployees xmlns:p=&quot;http://ws.wso2.org/dataservice/samples/rdbms_sample&quot;&gt;&lt;p:salary&gt;{salary}&lt;/p:salary&gt;&lt;/p:setSalaryForEmployees&gt;;<br>     var payload;<br>     for (var x = 0; x &lt; properties.length; x++) {<br>       clientvarPayload.setSalaryForEmployees+= &lt;p:employeeNumbers xmlns:p=”http://ws.wso2.org/dataservice/samples/rdbms_sample&quot;&gt;{properties[x]}&lt;/p:employeeNumbers&gt;;<br>      }<br>      mc.setPayloadXML(clientvarPayload);<br> ]]&gt;&lt;/script&gt;</pre><p><strong>References</strong></p><ul><li><a href="https://docs.wso2.com/display/DSS351/RDBMS+Sample">RDBMS Sample - Data Services Server 3.5.1 - WSO2 Documentation</a></li><li><a href="https://docs.wso2.com/display/EI620/XSLT+Mediator">XSLT Mediator - Enterprise Integrator 6.2.0 - WSO2 Documentation</a></li><li><a href="https://docs.wso2.com/display/EI620/Script+Mediator">Script Mediator - Enterprise Integrator 6.2.0 - WSO2 Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c12f4b91edf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to share RDBMS user-stores between tenants with WSO2 IS]]></title>
            <link>https://medium.com/@megala.11/how-to-share-rdbms-user-stores-between-tenants-with-wso2-is-2335c66303c9?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2335c66303c9</guid>
            <category><![CDATA[wso2is]]></category>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Fri, 30 Mar 2018 04:46:31 GMT</pubDate>
            <atom:updated>2018-03-30T04:46:31.009Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 products support multiple user-stores. This can be achieved by configuring secondary user-stores.</p><p>By default, secondary user-stores are bound to a tenant and even if we use the same database across different tenants, the users and roles that are added from a different tenant will not be visible in the new tenant.</p><p>In this blog, we will look into how can we use the same users and roles across multiple tenants.</p><ol><li>Add a secondary user-store using management console.</li></ol><p><a href="https://docs.wso2.com/display/IS541/Configuring+Secondary+User+Stores#ConfiguringSecondaryUserStores-ConfiguringusingtheManagementConsole">Configuring Secondary User Stores - Identity Server 5.4.1 - WSO2 Documentation</a></p><ol><li>After adding the secondary user-store from management console, you should be able to see a file with the name &lt;user-store-domain&gt;.xml in <strong>&lt;IS_HOME&gt;/repository/deployment/server/userstores </strong>folder, if it is super-tenant. For other tenants you could find a similar file in <strong>&lt;IS_HOME&gt;/repository/deployment/tenant/&lt;tenant_id&gt;/userstores </strong>folder.</li><li>In that file, you could see many SQL queries for different tasks such as adding a user, adding role, etc. Those are the queries that will be used when doing the user-management tasks with the particular user-store. This gives the flexibility for users to specify the relevant SQL queries that need to be executed while adding/modifying/deleting users/roles from the particular user-store. The default queries added will be having UM_TENANT_ID in the reference of the SQL queries. If we remove the UM TENANT_ID from the relevant SQL queries, we can access the users and roles across tenants.</li></ol><pre>&lt;Property name=”SelectUserSQL”&gt;SELECT * FROM UM_USER WHERE UM_USER_NAME=?&lt;/Property&gt;</pre><pre>&lt;Property name=”GetRoleListSQL”&gt;SELECT UM_ROLE_NAME, UM_SHARED_ROLE FROM UM_ROLE WHERE UM_ROLE_NAME LIKE ? AND UM_SHARED_ROLE =’0&#39; ORDER BY UM_ROLE_NAME&lt;/Property&gt;</pre><pre>&lt;Property name=”GetSharedRoleListSQL”&gt;SELECT UM_ROLE_NAME, UM_SHARED_ROLE FROM UM_ROLE WHERE UM_ROLE_NAME LIKE ? AND UM_SHARED_ROLE =’1&#39; ORDER BY UM_ROLE_NAME&lt;/Property&gt;</pre><pre>&lt;Property name=”UserFilterSQL”&gt;SELECT UM_USER_NAME FROM UM_USER WHERE UM_USER_NAME LIKE ? ORDER BY UM_USER_NAME&lt;/Property&gt;</pre><pre>&lt;Property name=”UserRoleSQL”&gt;SELECT UM_ROLE_NAME FROM UM_USER_ROLE, UM_ROLE, UM_USER WHERE UM_USER.UM_USER_NAME=? AND UM_USER.UM_ID=UM_USER_ROLE.UM_USER_ID AND UM_ROLE.UM_ID=UM_USER_ROLE.UM_ROLE_ID&lt;/Property&gt;</pre><pre>&lt;Property name=”UserSharedRoleSQL”&gt;SELECT UM_ROLE_NAME, UM_SHARED_ROLE FROM UM_SHARED_USER_ROLE INNER JOIN UM_USER ON UM_SHARED_USER_ROLE.UM_USER_ID = UM_USER.UM_ID INNER JOIN UM_ROLE ON UM_SHARED_USER_ROLE.UM_ROLE_ID = UM_ROLE.UM_ID WHERE UM_USER.UM_USER_NAME = ? &lt;/Property&gt;</pre><pre>&lt;Property name=”IsRoleExistingSQL”&gt;SELECT UM_ID FROM UM_ROLE WHERE UM_ROLE_NAME=?&lt;/Property&gt;</pre><pre>&lt;Property name=”GetUserListOfRoleSQL”&gt;SELECT UM_USER_NAME FROM UM_USER_ROLE, UM_ROLE, UM_USER WHERE UM_ROLE.UM_ROLE_NAME=? AND UM_USER.UM_ID=UM_USER_ROLE.UM_USER_ID AND UM_ROLE.UM_ID=UM_USER_ROLE.UM_ROLE_ID&lt;/Property&gt;</pre><pre>&lt;Property name=”GetUserListOfSharedRoleSQL”&gt;SELECT UM_USER_NAME FROM UM_SHARED_USER_ROLE INNER JOIN UM_USER ON UM_SHARED_USER_ROLE.UM_USER_ID = UM_USER.UM_ID INNER JOIN UM_ROLE ON UM_SHARED_USER_ROLE.UM_ROLE_ID = UM_ROLE.UM_ID WHERE UM_ROLE.UM_ROLE_NAME= ? &lt;/Property&gt;</pre><pre>&lt;Property name=”IsUserExistingSQL”&gt;SELECT UM_ID FROM UM_USER WHERE UM_USER_NAME=?&lt;/Property&gt;</pre><pre>&lt;Property name=”GetUserPropertiesForProfileSQL”&gt;SELECT UM_ATTR_NAME, UM_ATTR_VALUE FROM UM_USER_ATTRIBUTE, UM_USER WHERE UM_USER.UM_ID = UM_USER_ATTRIBUTE.UM_USER_ID AND UM_USER.UM_USER_NAME=? AND UM_PROFILE_ID=?&lt;/Property&gt;</pre><pre>&lt;Property name=”GetUserPropertyForProfileSQL”&gt;SELECT UM_ATTR_VALUE FROM UM_USER_ATTRIBUTE, UM_USER WHERE UM_USER.UM_ID = UM_USER_ATTRIBUTE.UM_USER_ID AND UM_USER.UM_USER_NAME=? AND UM_ATTR_NAME=? AND UM_PROFILE_ID=?&lt;/Property&gt;</pre><p>Likewise modify all the queries by removing UM_TENANT_ID column.</p><p>After that create a tenant and add the same database as the secondary user-store and modify the queries as above. Now you should be able to use same users and roles across tenants.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2335c66303c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Get Scopes Related with an Application Based on Subscribed APIs in WSO2 API Manager 2.1.0?]]></title>
            <link>https://medium.com/@megala.11/how-to-get-scopes-related-with-an-application-based-on-subscribed-apis-in-wso2-api-manager-2-1-0-a8033de4a040?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8033de4a040</guid>
            <category><![CDATA[api-management]]></category>
            <category><![CDATA[scope-management]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Wed, 06 Dec 2017 12:11:08 GMT</pubDate>
            <atom:updated>2017-12-06T12:11:08.043Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 API Manager provides the capability to create, manage and publish APIs. APIs are very important in most of the business scenarios today. The list of users, who can use the particular API can vary based on the nature of the business. Hence, there should be a proper way of securing APIs. API Manager provides OAuth 2.0 based secured access to the APIs.</p><p>However due to high impact of APIs in business scenarios, it is important to have fine grained authorization to API resource level. Fine grained authorization is provided by OAuth 2.0 <a href="https://docs.wso2.com/display/AM210/Key+Concepts#KeyConcepts-OAuthscopes">scopes</a> in API Manager. When creating the API, we can add relevant scopes to each API resource as below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6Ny8HPHnpccSIxKb." /><figcaption>Adding scopes</figcaption></figure><pre>Above screenshot shows a sample scenario, where an API is exposed in an online food delivery service. There are 3 roles in the system, which are delivery_boy, customer_service_agent and manager. As the name indicates, relevant employees will be added to relevant roles, based on their position.</pre><pre>As shown above API resources that are used for adding and updating the order can only be accessible by customer_service_agents and manager. Getting the order details is exposed to delivery_boy, customer_service_agent and manager roles. Deleting an order is a sensitive operation, so it can only be used by manager.</pre><p>We need to <a href="https://docs.wso2.com/display/AM210/Subscribe+to+an+API">subscribe</a> to an API, to generate the relevant access token to access the API. However when generating the access token, we need to pass the relevant scopes as an argument, to get the token generated with relevant scopes. Even though if we have an access token but without scopes, we cannot access the relevant API resources that are protected with scopes. So it is an essential requirement, for an subscriber to know the relevant scopes related with the subscribed API before generating token.</p><p>In the current API Store UI, when generating token with application client ID and client secret, if there are any scopes related with the subscribed APIs, those will be listed as below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rO14ghn6A-oLQooQ." /></figure><p>The API subscribers can select the scopes and generate the access token. This is achieved in UI using jaggery APIs. Recently we introduced a new REST API to achieve extended similar capability with the <a href="https://docs.wso2.com/display/ADMIN44x/Updating+WSO2+Products">WUM</a> update. In order to get the scopes of an application based on subscribed APIs, application UUID should be passed as path parameter. Application UUID can be retrieved by using following curl URL,</p><pre>curl -k -H “Authorization: Bearer a2ddc5fb-6509–3dc7–8956-f47037a3cf52” “https://localhost:9443/api/am/store/v0.11/applications/&quot;</pre><p>Response will be in followoing format,</p><pre>{“count”:1,”next”:””,”previous”:””,”list”:[{“applicationId”:”f1d1095d-5928–427e-8100–968ea09d637f”,”name”:”DefaultApplication”,”subscriber”:”delivery_boy”,”throttlingTier”:”Unlimited”,”description”:null,”status”:”APPROVED”,”groupId”:””}]</pre><p>Then we can call the REST API for getting scopes as below</p><pre>curl -k -H “Authorization: Bearer a2ddc5fb-6509–3dc7–8956-f47037a3cf52” “https://localhost:9443/api/am/store/v0.11/applications/scopes/f1d1095d-5928-427e-8100-968ea09d637f&quot;</pre><p>This will return all the scopes as below,</p><pre>{“list”:[{“key”:”orderUpdate”,”name”:”orderUpdate”,”roles”:”customer_service_agent,manager”,”description”:””},{“key”:”addOrder”,”name”:”addOrder”,”roles”:”customer_service_agent,manager”,”description”:””},{“key”:”orderDelete”,”name”:”orderDelete”,”roles”:”manager”,”description”:””},{“key”:”delivery”,”name”:”delivery”,”roles”:”delivery_boy,customer_service_agent,manager”,”description”:””}]}</pre><p>This API also supports an optional query parameter which is “filterByUserRoles”. By default “filterByUserRoles” parameter is considered as false. If the filterByUserRoles is set to true, only the relevant scopes, that the particular user is entitled to will be returned based on user roles.</p><p>When the filterByUserRoles is set to true, responses for the scope REST API will vary as follow,</p><p><strong>Request</strong></p><pre>curl -k -H “Authorization: Bearer a2ddc5fb-6509–3dc7–8956-f47037a3cf52” “https://localhost:9443/api/am/store/v0.11/applications/scopes/f1d1095d-5928-427e-8100-968ea09d637f?filterByUserRoles=true&quot;</pre><p>For delivery boy,</p><pre>{“list”:[{“key”:”delivery”,”name”:”delivery”,”roles”:”delivery_boy,customer_service_agent,manager”,”description”:””}]}</pre><p>For customer service agent,</p><pre>{“list”:[{“key”:”orderUpdate”,”name”:”orderUpdate”,”roles”:”customer_service_agent,manager”,”description”:””},{“key”:”addOrder”,”name”:”addOrder”,”roles”:”customer_service_agent,manager”,”description”:””},{“key”:”delivery”,”name”:”delivery”,”roles”:”delivery_boy,customer_service_agent,manager”,”description”:””}]}</pre><p>For manager,</p><pre>{“list”:[{“key”:”orderUpdate”,”name”:”orderUpdate”,”roles”:”customer_service_agent,manager”,”description”:””},{“key”:”addOrder”,”name”:”addOrder”,”roles”:”customer_service_agent,manager”,”description”:””},{“key”:”orderDelete”,”name”:”orderDelete”,”roles”:”manager”,”description”:””},{“key”:”delivery”,”name”:”delivery”,”roles”:”delivery_boy,customer_service_agent,manager”,”description”:””}]}</pre><p>For the purpose of caching scopes we have introduced a cache called “ScopeCache”, which caches, the scope entries against particular user. This can be enabled by adding following configuration under CacheConfigurations element in api-manager.xml in &lt;APIM_Home&gt;/repository/conf directory.</p><pre>&lt;CacheConfigurations&gt;<br>     .....<br>    &lt;EnableScopeCache&gt;true&lt;/EnableScopeCache&gt;<br>&lt;/&lt;CacheConfigurations&gt;</pre><p>We highly recommend to enable this cache, if the API Manager setup is in a environment where the subscription changes or user role list changes does not happen very frequently. Enabling this cache will give positive effect on the performance.</p><p>However, if you are in a development environment, where the API subscription changes or user role update changes happens frequently, this cache can be disabled by setting “EnableScopeCache” element to false.</p><p>In order to use this feature, <a href="https://wso2.com/api-management/">download WSO2 API Manager 2.1.0</a> and update it through <a href="https://docs.wso2.com/display/ADMIN44x/Updating+WSO2+Products">WUM</a>.</p><h4>References</h4><ul><li><a href="https://docs.wso2.com/display/AM210/WSO2+API+Manager+Documentation">WSO2 API Manager Documentation - API Manager 2.1.0 - WSO2 Documentation</a></li><li><a href="https://docs.wso2.com/display/ADMIN44x/Updating+WSO2+Products">Updating WSO2 Products - Administration Guide 4.4.x - WSO2 Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8033de4a040" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unit tests for WSO2 IoT server — Learning points]]></title>
            <link>https://medium.com/@megala.11/unit-tests-for-wso2-iot-server-learning-points-6f55abe5b5fd?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f55abe5b5fd</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[unit-testing]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Mon, 23 Oct 2017 15:28:34 GMT</pubDate>
            <atom:updated>2017-10-23T15:32:49.019Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 IoT server provides the capability of managing different EMM and IoT devices. It can be downloaded from [1]. This blog post will discuss about some of the key learning points captured while writing some unit tests for IoT server.</p><p>Unit testing is important to make sure whether a component/unit/method works as expected under correct circumstances and whether those components correctly handle negative scenarios. By including unit test cases, we can reduce the issues that are encountered while integrating with other components.</p><p>Unit tests are written for the component repositories. carbon-device-mgt [2] and carbon-device-mgt-plugins [3] are the main component repositories that provide the core functionality of IoT server. We have used TestNG as the testing framework for our component repositories. We have also heavily used mockito [4] and powermocko [5] for mocking the objects and static methods.</p><h3>Testing positive scenarios</h3><p>Testing happy path of a method involves giving correct inputs and checking whether the correct outputs are returned. We can make use of assertions for this as below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc556ea9d7c49045752f81976ee1a435/href">https://medium.com/media/cc556ea9d7c49045752f81976ee1a435/href</a></iframe><blockquote>Learning point — It is always good to include an additional parameter to indicate the cause for the test case failure as it will always give an idea of the test case failure, otherwise TestNG will report something like follow, expected [true] but found[false] , which will not give any idea on the test case failure, unless you have a look at the test method.</blockquote><p>This will be only useful for the methods that has a return value. However, for the methods that do not return any value, we have some other ways of testing.</p><ul><li>Calling the method with the correct values to make sure there are no run time exceptions or checked exceptions are thrown. We do not need to catch and assert fail the test case, in case of exception, we can simply add the exceptions to test method as below,</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b5b88fb173ecf6e97eedfc192050419/href">https://medium.com/media/7b5b88fb173ecf6e97eedfc192050419/href</a></iframe><blockquote>Learning point — Above test case will automatically fail, if there is a “DeviceManagementException” while executing the test method. No need to catch the exception and fail it. In-addition to that when implementing the test methods, we do not need to include the java-doc comments, testNG provides an annotation called “description” to include a description of test cases. It is recommended to include those descriptions when adding test cases to give a better readability and understandability on test cases.</blockquote><ul><li>Another way of handling this type of methods is if particular method we are testing is setting some values for the private variables during the method execution. We can make use of reflection API [6] and make it accessible outside from the object and assert them and check.</li></ul><h3>Testing negative scenarios</h3><p>Main purpose behind testing the negative scenarios is to make sure that no run-time exceptions are thrown and all the exceptions are properly handled based on the respective component. For instance, if there is an exception in a service layer or database layer, recommended practice is to wrap it with the component specific exception, and throw it to the front layer. If there is an exception, in the API layer, we will send a response back to the end-user to indicate the failure of the API invocation.</p><p>For the components which throw the exceptions such as DB and service layer, we can use the testNG level annotations to test whether proper checked exceptions are thrown instead of run-time exceptions. Following is an example on how to test the negative scenarios.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2a4ac632f8f5733ad63b9d24ba7b2b8/href">https://medium.com/media/f2a4ac632f8f5733ad63b9d24ba7b2b8/href</a></iframe><blockquote>Learning point — “expectedExceptions” annotation is used for mentioning what are the expected exception classes that should be thrown. The test case will fail if the relevant exception is not thrown. . “expectedExceptionsMessageRegExp” is useful for validating the exception message. We can also use wildcard characters when validating the exception message.</blockquote><p>For the API layer which does not throw an exception, we can validate the response, using assertions.</p><h3>Issues encountered and how they were solved</h3><h3>Testing database layer</h3><p>We have used the h2 in-memory database for testing the database layer. In order to test the positive scenarios, we have created a database with relevant tables and called the relevant methods and asserted them[7]. In order to simulate the erroneous scenarios, we have created a database without the relevant tables. So this will throw the sql exception for all the database method calls. Likewise we have tested the negative scenarios as well.</p><h3>Testing API layer</h3><p>API layer heavily uses OSGi services. In component repositories, those services are taken from OSGi environment by using a static method [8]. In order to test the API layer, it is required to mock these static methods and return the relevant services. As within the API method execution, these methods will be called. In order to mock the static method, powermock is used and to create the mock services, mockito is used.</p><p>As an example, NotificationManagementServiceImpl API makes uses of an OSGi service, NotificationManagementService [9], So in the relevant test case, we have used following code segments,</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be1adbb0ea3eb4d78d3117d0754e2c99/href">https://medium.com/media/be1adbb0ea3eb4d78d3117d0754e2c99/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/222626c1e94aa370b49eff49b7563f74/href">https://medium.com/media/222626c1e94aa370b49eff49b7563f74/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/345fb74a7fcab27b8c1d0d98c2a9b0b7/href">https://medium.com/media/345fb74a7fcab27b8c1d0d98c2a9b0b7/href</a></iframe><p>As we have mocked “getNotificationManagementService” static method, whenever “getNotificationManagementService” is called it will return the mocked notificationmanagement service without calling the real method.</p><p>You can find the full test class for the NotificationManagementServiceAPI at [10]</p><p>Hope you all have learned some recommended practices and some techniques for writing unit test cases</p><p><strong>References</strong></p><p>[1] <a href="https://wso2.com/iot">https://wso2.com/iot</a></p><p>[2] <a href="https://github.com/wso2/carbon-device-mgt">https://github.com/wso2/carbon-device-mgt</a></p><p>[3] <a href="https://github.com/wso2/carbon-device-mgt-plugins">https://github.com/wso2/carbon-device-mgt-plugins</a></p><p>[4] <a href="http://site.mockito.org/">http://site.mockito.org/</a></p><p>[5] <a href="https://github.com/powermock/powermock/wiki">https://github.com/powermock/powermock/wiki</a></p><p>[6] <a href="https://docs.oracle.com/javase/tutorial/reflect/">https://docs.oracle.com/javase/tutorial/reflect/</a></p><p>[7] <a href="https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java#L104">https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/java/org/wso2/carbon/device/mgt/extensions/utils/Utils.java#L104</a></p><p>[8] <a href="https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java#L200">https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/DeviceMgtAPIUtils.java#L200</a></p><p>[9] <a href="https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/NotificationManagementServiceImpl.java#L68">https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/NotificationManagementServiceImpl.java#L68</a></p><p>[10] <a href="https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/NotificationManagementServiceImplTest.java">https://github.com/wso2/carbon-device-mgt/blob/master/components/device-mgt/org.wso2.carbon.device.mgt.api/src/test/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/NotificationManagementServiceImplTest.java</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f55abe5b5fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to visualize WSO2 APIM statistics in DAS?]]></title>
            <link>https://medium.com/@megala.11/how-to-visualize-wso2-apim-statistics-in-das-c349b3fd83a?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c349b3fd83a</guid>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[wso2das]]></category>
            <category><![CDATA[wso2-apim]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Sat, 24 Jun 2017 13:34:59 GMT</pubDate>
            <atom:updated>2017-12-06T04:08:21.432Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 API Manager provides publisher and store statistics such as API usage by subscribers, API Usage by geolocation, etc. This is a very useful when there is a requirement for monitoring or reporting. These statistics can be viewed by visiting the publisher and store apps. Please refer details on configuring them in [1]. However, if we are using multiple WSO2 products and there may a requirement to view the statistics from all the products in a single place. In such scenarios, WSO2 Data Analytics Server can be used to visualize the data. However currently we do not have out-of-box support for visualizing the same API Manager statistics in DAS. In this post, we will go through steps required for creating a gadget that will visualize the API Manager Statistics. In this blog I will specifically describe on how to create the gadget “API Usage Comparison ”. Here I am using APIM 2.1.0 and DAS 3.1.0. You can download them from [2] and [3]. Please note since we are using the h2 database in this one for saving the statistics data, it is required both the server distributions are on the same directory.</p><p><strong>Step 1</strong></p><p>If we are running both the servers in the same machine, we need to make a server to start with the different port. Here, I am going to start the DAS server in different port (i.e. wso2 products use 9443 as the default port for https transport). In order to start the DAS server in 9444 port, go to</p><pre>&lt;DAS_Home&gt;/repository/conf/carbon.xml</pre><p>and update the offset as below,</p><pre>&lt;Ports&gt;<br>&lt;Offset&gt;1&lt;/Offset&gt;</pre><p><strong>Step 2</strong></p><p>Start the WSO2 DAS and install the APIM Analytics features as mentioned in [4]. Please make sure to install the latest features as they will have the latest bug fixes. This will copy the relevant artifacts needed for getting the data from APIM and summarizing them in DAS.</p><p><strong>Step 3</strong></p><p>Configure the APIM analytics as mentioned in [5]. This documentation talks about the API-M Analytics Server, in this context it simply to DAS with the APIM Analytics capabilities. After doing the changes start the API Manager.</p><p><strong>Step 4</strong></p><p>To make sure the data is pumped to the the DAS from the API Manager, please invoke an API. If you do not have any APIs, you can use the sample API. After invoking the API, wait for 1 minute and visit the the DAS Data explorer as mentioned in [6], and view the table</p><pre>ORG_WSO2_ANALYTICS_APIM_REQUESTPERMINSTREAM</pre><p>It should at least have a row like below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-mGETIFKPlAQJbN-." /></figure><p>If you cannot see this record, then there is an issue with the data publishing from API Manager to DAS, double check the previous steps and make sure it works before moving to the next step.</p><p><strong>Step 5</strong></p><p>Since we have the data now in the DAS side, we need to visualize them in DAS. You can find the details of creating a dashboard in [7]. In this document, it talks about generating gadget. Here the way we are going to create the gadget is quite different as we are going to use a JDBC client to directly get the data from the database as the spark scripts are configured in the API Manager such that it writes to the external database. So the generating gadget part is not applicable for this context.</p><p><strong>Step 6</strong></p><p>API Manager uses a RDBMSClient [8] to load the data from the database, so we need to replicate similar client and add it to the DAS, so that we can directly use that client to retrieve the data. Since here we are only creating the sample gadget for the API Usage Comparison, I have created a sample client only with the related method. You can find the sample client I created at [9].</p><p><strong>Step 7</strong></p><p>In order to load the data, we need to access the RDMSClient created above and call the relevant method. Jaggery provides support for accessing the java methods directly. We can easily access these methods by creating a simple jaggery api. This api should call the method in java client and return results back. You can find the similar jaggery api, that I have used at [11]. Since the dashboard rendering happens in a jaggery app called portal, and other jaggery apis, used by the DAS are added under</p><pre>&lt;DAS_HOME&gt;/repository/deployment/server/jaggeryapps/portal/ controllers/apis</pre><p>We can add our apis also under the same location, so that we can access the api directly by using following url,</p><pre>https://&lt;DAS_HOST&gt;:&lt;DAS_PORT&gt;/portal/apis/apim-analytics</pre><p>Here the last part refers to the filename, so if you have the api with a different name, you will need to change the name as well.</p><p><strong>Step 8</strong></p><p>With the previous step, the tasks related to the back end is completed. Now we will look into how can we create the gadget to visualize it. Please refer the documentation on creating the gadget at [12]. In the index.xml, we need to add the relevant js and css files in content section and other elements that are needed for the visualization purpose. For visualization purposes you can use any of the visualization libraries. For this sample implementation, I have used the VizGrammar [13] which provides an easy way of creating graphs based on the config.</p><p><strong>Step 9</strong></p><p>In the sample gadget, I have created a gadget definition index.xml with a single div element, that is needed for rendering the graph. I have also included two js files, which will hold the VizGrammar configurations that are needed for rendering the gadget and other file will load the data by calling the jaggery api and then to draw the graph based on that. Other js files are specific to Vizgrammer.</p><p><strong>Step 10</strong></p><p>Now the artifacts needed for visualization has been created. To add them to the server, please fo the following steps.</p><ol><li>Stop both DAS and APIM servers.</li><li>Add the RDBMS client jar file to the &lt;DAS_HOME&gt;/ repository/components/lib</li><li>Copy the jaggery api to &lt;DAS_HOME&gt;/repository/deployment/server/jaggeryapps/portal/ apis</li><li>Copy the created gadget to &lt;DAS_HOME&gt;/repository/deployment/server/jaggeryapps/ portal/store/carbon.super/fs/gadget/ directory.</li><li>Now start both the servers and now you can add the gadget to the dashboard (Refer [7] for more information regarding dashboard).</li></ol><p>Please find the screenshot of the sample gadget below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*elGrj811ldTjVsAb." /></figure><p>You can find the sample gadget at [14]. This sample gadget will visualize only for a period of last one month. But you can create the gadget that will visualize the data for different time-period. For this you will need to create a data-range picker and then you need to add pub-sub connection between this gadget and the date-range picker. You can find the relevant details regarding the pub-sub connection in [15]</p><h3>References</h3><p>[1] <a href="https://docs.wso2.com/display/AM210/Viewing+API+Statistics">https://docs.wso2.com/display/AM210/Viewing+API+Statistics</a></p><p>[2] <a href="http://wso2.com/api-management/">http://wso2.com/api-management/</a></p><p>[3] <a href="http://wso2.com/smart-analytics">http://wso2.com/smart-analytics</a></p><p>[4]<a href="https://docs.wso2.com/display/AM210/Installing+WSO2+APIM+Analytics+Features">https://docs.wso2.com/display/AM210/Installing+WSO2+APIM+Analytics+Features</a></p><p>[5] <a href="https://docs.wso2.com/display/AM210/Configuring+APIM+Analytics">https://docs.wso2.com/display/AM210/Configuring+APIM+Analytics</a></p><p>[6] <a href="https://docs.wso2.com/display/DAS310/Data+Explorer#DataExplorer-Viewingrecordsofatable">https://docs.wso2.com/display/DAS310/Data+Explorer#DataExplorer-Viewingrecordsofatable</a></p><p>[7] <a href="https://docs.wso2.com/display/DAS310/Analytics+Dashboard">https://docs.wso2.com/display/DAS310/Analytics+Dashboard</a></p><p>[8] <a href="https://github.com/wso2/carbon-apimgt/blob/v6.1.94/components/apimgt/org.wso2.carbon.apimgt.usage/org.wso2.carbon.apimgt.usage.client/src/main/java/org/wso2/carbon/apimgt/usage/client/impl/APIUsageStatisticsRdbmsClientImpl.java">https://github.com/wso2/carbon-apimgt/blob/v6.1.94/components/apimgt/org.wso2.carbon.apimgt.usage/org.wso2.carbon.apimgt.usage.client/src/main/java/org/wso2/carbon/apimgt/usage/client/impl/APIUsageStatisticsRdbmsClientImpl.java</a></p><p>[9]<a href="https://github.com/Megala21/sampleclient/blob/master/src/main/java/sample/client/RDBMSClient.java">https://github.com/Megala21/sampleclient/blob/master/src/main/java/sample/client/RDBMSClient.java</a></p><p>[10] <a href="http://jaggeryjs.org/">http://jaggeryjs.org/</a></p><p>[11]<a href="https://github.com/Megala21/sampleclient/blob/master/src/main/resources/jaggeryapi/apim-analytics.jag">https://github.com/Megala21/sampleclient/blob/master/src/main/resources/jaggeryapi/apim-analytics.jag</a></p><p>[12]<a href="https://docs.wso2.com/display/DS200/Creating+a+Gadget"> https://docs.wso2.com/display/DS200/Creating+a+Gadget</a></p><p>[13] <a href="https://github.com/wso2/VizGrammar">https://github.com/wso2/VizGrammar</a></p><p>[14]<a href="https://github.com/Megala21/sampleclient/tree/master/src/main/resources/gadget">https://github.com/Megala21/sampleclient/tree/master/src/main/resources/gadget</a></p><p>[15]<a href="https://docs.wso2.com/display/DS200/Configuring+Gadgets+for+Inter-gadget+Communication">https://docs.wso2.com/display/DS200/Configuring+Gadgets+for+Inter-gadget+Communication</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c349b3fd83a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to check the H2 database used by WSO2 Dashboard Server in UI?]]></title>
            <link>https://medium.com/@megala.11/how-to-check-the-h2-database-used-by-wso2-dashboard-server-inui-f0f7b5885dec?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0f7b5885dec</guid>
            <category><![CDATA[wso2]]></category>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Mon, 31 Oct 2016 03:47:03 GMT</pubDate>
            <atom:updated>2017-12-06T04:06:45.829Z</atom:updated>
            <content:encoded><![CDATA[<p>WSO2 Dashboard Server uses H2 as the default database. In order to check the entries of different tables in the H2 database, go to {DS_HOME}/repository/conf/ and in the carbon.xml, add the following configuration.</p><p><strong>&lt;H2DatabaseConfiguration&gt;</strong></p><p><strong>&lt;property name=”web” /&gt;</strong></p><p><strong>&lt;property name=”webPort”&gt;8082&lt;/property&gt;</strong></p><p><strong>&lt;property name=”webAllowOthers” /&gt;</strong></p><p><strong>&lt;/H2DatabaseConfiguration&gt;</strong></p><p>After changing the carbon.xml, restart the Dashboard Server and go to <a href="http://{ip_address}:{port_numer}">http://{ip_address}:{port_numer}</a> (<a href="http://localhost:8082/">http://localhost:8082</a>)</p><p>You will see the following screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vlKfTa7OSNRILtPW." /></figure><p>To check a H2 database used by the Dashboard Derver, go to {DS_HOME}/repository/conf/datasources and open the master-datasources.xml, and for the JDBC URL give the URL mentioned in the relevant data source and the user name and password as below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ATlyOvXeNuRO5284." /></figure><p>If you have entered JDBC URL, User Name and Password and press Connect, you will be able to see the following screen which lists the all the tables in the specific database,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f10ZfSNr-J2hnU0A." /></figure><p>You can also follow the same procedure for the DS specific database and the relevant configuration details can be found in ds-datasources.xml which resides in {DS_HOME}/repository/conf/datasources.</p><p>This proceudre is applicable for all the WSO2 products.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0f7b5885dec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Shindig Errors with WSO2 Dashboard Server]]></title>
            <link>https://medium.com/@megala.11/common-shindig-errors-with-wso2-dashboard-server-a2beed92c641?source=rss-76e9e818d3bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2beed92c641</guid>
            <dc:creator><![CDATA[Megala Uthayakumar]]></dc:creator>
            <pubDate>Sat, 30 Jul 2016 12:52:22 GMT</pubDate>
            <atom:updated>2016-07-30T12:56:57.364Z</atom:updated>
            <content:encoded><![CDATA[<h4>Security error for container sandbox-gadget-usa-map : OpenAjax.hub.SecurityAlert.LoadTimeout</h4><p>This error can happen when we have the pub-sub gadgets in the dashboard. Shindig uses the pub-sub 2 feature of OpenAjax.hub. In OpenAjax.hub in order to avoid the phishing attacks, timeout is used and if a iframe with the gadget is not loaded within a particular time, it throws the security exception and will immediately stop the iframe loading process to avoid the iframe phishing.Please refer [1] for more details.</p><p>OpenAjax hub has provided a way to configure the timeout based on user preferences. Since the iframe loading timeout will differ according to each gadget due to many factors .For instance, a gadget need to make only 1 ajax call to get some data for rendering purposes. Mean time another complex gadget may want to make 10 ajax calls to get relevant data. So it differs according to complexity of the gadget.</p><p>Although shindig uses the OpanAjax hub for pubsub mechanism, but it does not provide a way to configure the timeout. So the load timeout is flat 15 seconds for all the pub-sub gadgets regardless of complexity of the gadgets. So in DS, We have come up with the way to provide the configurable timeout by extending shindig features.</p><p>In DS, we have change the default timeout to be 60 seconds (Given that 15 seconds is not sufficient enough in a production environment). Furthermore, user can decide the time-out per gadget basics by</p><ul><li>including a “timeoutInterval” (Should be in milliseconds) under settings in gadget.json.</li></ul><p>or</p><ul><li>In the gadget configuration panel, there is a option available for setting the timeout interval by manually entering timeout Interval in milliseconds.</li></ul><p>Code level changes for this feature can be found at [2]</p><h4>References</h4><p>[1]<a href="http://www.openajax.org/member/wiki/OpenAjax_Hub_2.0_Design_Comments#Frame_Phishing:_Load_Time-Out">http://www.openajax.org/member/wiki/OpenAjax_Hub_2.0_Design_Comments#Frame_Phishing:_Load_Time-Out</a></p><p>[2] <a href="https://github.com/wso2/carbon-dashboards/pull/252">https://github.com/wso2/carbon-dashboards/pull/252</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2beed92c641" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>