Monday, April 20, 2015

Simple http based file sharing server with in a second!

Recently i have come across a situation where I have to quickly need to share a file with my colleague and i did not had any ftp servers or any portable devices with me at that time!

So instance solution.... use Python!!!! if you have already installed the python in you machine.

Go to the directory that you want to share your files
Run "python -m SimpleHTTPServer 8000"

Then give your IP address to your friend and Now he can access your directory via browser ::)

Tuesday, March 31, 2015

Invoking WSO2 ESB proxy which uses Entitlement Mediator to evaluate a XACML rule in the WSO2 Identity Server in WSO2 Stratos 1.6

In this blog, I am assuming that you have an understanding on XACML Policy Language and use of WSO2 Stratos 1.6





This it the full synapse configuration that has been used in this sample.

Wednesday, February 18, 2015

WSO2 ESB SOAP headers lost

 During the connector and we experience some of the SOAP header information are being dropped by the ESB.

Please find the retrieved SOAP headers from direct API call and ESB call below.

Response from Direct API call
Response from ESB call
   <soap:Header>
      <wsa:Action>RetrieveResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:7607e97e-463e-4fa2-92e9-afb48b90acda</wsa:MessageID>
      <wsa:RelatesTo>urn:uuid:a7ddc645-63fa-471b-8dad-e5a7909e25a2</wsa:RelatesTo>
      <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-abd7433b-821f-4a23-861e-83ade6857961">
            <wsu:Created>2015-02-17T11:39:37Z</wsu:Created>
            <wsu:Expires>2015-02-17T11:44:37Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>
<soap:Header>
      <wsse:Security>
         <wsu:Timestamp wsu:Id="Timestamp-ec0a6c73-4633-437a-a555-6482f6a72f5d">
            <wsu:Created>2015-02-17T11:57:44Z</wsu:Created>
            <wsu:Expires>2015-02-17T12:02:44Z</wsu:Expires>
         </wsu:Timestamp>
      </wsse:Security>
   </soap:Header>


We can observe that the API is returning complete set of header information to the ESB in wire log, yet ESB returns only a selected set from it as shown above.

Reason for this issue is WS Addressing headers are removed while sending out. This can be solved by introducing Synapse Property "PRESERVE_WS_ADDRESSING" ( <property name="PRESERVE_WS_ADDRESSING" value="true" scope="default" /> )

Further detail can be found in [1]

Friday, January 30, 2015

WSO2's 6th Office opened in Jaffna

WSO2 has opened a office at Jaffna with 10 employees including 9 software engineers



Wednesday, December 10, 2014

Remove the payload and send POST request to backend via wso2 esb

There are situations where back-end does not need a payload for POST request. However in wso2 ESB has the payload that mediate before the back-end call. In order to drop the message payload you need to perform two tasks in the wso2 ESB.



Example is given below that demonstrate the use case. 

Tuesday, December 9, 2014

Bind WSO2 Mamanement Console to a certain IP Adress

There are lot of Security measures when deploy the WSO2 Server products. One of them is to restrict the accessibility of the server for certain IP addresses.

In WSO2 serves, it is possible to restrict via the the tomcat valve.

Edit
/repository/conf/tomcat/context.xml 


Add
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1"/ >

How to delete the element in the array of json object in Java-script

Recently we had a very basic requirement to delete an key value pare in the json array using Javascript.


Input data

{"invideoPromotion":{"items":[{"id":{"type":"video","videoId":"11","websiteUrl":""},"timing":{"type":"ms","offsetMs":"2222"},"customMessage":"aa","promotedByContentOwner":"vanji"}]}}

Expected business logic

When type of id is video and websiteUrl is null; websiteUrl should be removed from the payload.

Output data

{"items":[{"id":{"type":"video","videoId":"11"},"timing":{"type":"ms","offsetMs":"2222"},"customMessage":"aa","promotedByContentOwner":"vanji"}]}}

In-order to do this you can use delete functionality of the json in javascript.

Example code