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



Wednesday, November 5, 2014

How to get the tables list in ms sql server that has the data



This query will help to see the data size details in tables of the MS SQL database.

SELECT 
    t.NAME AS TableName,
    s.Name AS SchemaName,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB, 
    SUM(a.used_pages) * 8 AS UsedSpaceKB, 
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB
FROM 
    sys.tables t
INNER JOIN      
    sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN 
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN 
    sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN 
    sys.schemas s ON t.schema_id = s.schema_id
WHERE 
    t.NAME NOT LIKE 'dt%' 
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255 
GROUP BY 
    t.Name, s.Name, p.Rows
ORDER BY 
    t.Name

Retrieving source IP detail in WSO2 ESB and APIM



These properties will retrieve the respective source IP into the properties.


Remote host 

   <property name="client-host" expression="get-property('axis2', 'REMOTE_HOST')" />

Remote address 

   <property name="client-address" expression="get-property('axis2', 'REMOTE_ADDR')" />

X-Forwarded-For

   <property name="xforward-header" expression="$trp:X-Forwarded-For""/> />