Tuesday, 25 March 2014

Event Monitoring in WMB

Auditing vs Logging
From what I have worked on, there is a difference between them based on their nature. A log is(may be) perishable while an audit trail is secure and non-perishable. As a result ou will never log sensitive information or information which you will need later. An audit trail on the other hand is secure. It is something that should not be perished easily.
For example : in a bank software you will audit the transactions;: credit-debit, failed transactions etc. This audit will be in to the database. THe log file may save the transaction that crashed when the softare failed and did not enter the system.
Difference between Audit log and normal log
An audit log contains all the information necessary to follow a user's interaction with a system. It will usually contain more information and detail than what is necessary to have in day-to-day operations.
You can think of it in terms of a phone system. You can record every call that passes through the phone system to be able to go back in time and prove exactly what a person said, but it wouldn't be feasible to use a log containing all of that information for taking care of phone system operations.
An audit log usually contains more sensitive information than other system logs so access to it should be more restricted.
Example scenario:
i use audit to trace the users actions, and to reconstruct current values.
for instance, we have a table with giftcardvalues, and we can see in that table that the current value is $100 and the original value $200.
Is that correct, we don't know....
for that question to be answered we have to know what happened in between.
so we have a audit table in which we save all actions for that table, like this:
jan. 1 init $200
jan. 3 add $300
jan. 5 subtract $350
jan. 7 check value (returned 150)
jan. 8 subtract $50
now i know what to say if a user calls and says: hey, where did my $100 go?
'normal' logging is used to log errors, process info etc. wo we can debug the app when, for instance, the audit info and the actual values for the giftcard don't match, so we can see what is going wrong in the code.
Statistics vs Event Monitoring
Statistics : Gives the statistical information about Broker,Execution Group,Message Flow.This will also  collect metrics information about the broker,EG,Message flow ,Resources such as JMS,JDBC,FTP,etc.
Event Monitoring:
Message broker emits a monitoring event (an XML document) when something interesting happens. Events are typically emitted to support transaction monitoring, transaction auditing, and business process monitoring. The event XML conforms to the monitoring event schema WMBEvent.xsd.
Event types
You can configure a message flow to emit two types of events: transaction events and terminal events. There are three types of transaction events: start, end, and rollback. The transaction events are emitted only from input nodes such as MQInput and HTTPInput. Terminal events are emitted from any terminal of any node.

Event Monitoring works on the basis of Pub-Sub feature of message broker.The events emitted from terminals or transaction in a flow are XML messages and they are published to specific topics.
Eg:  Topic name here is  BROKER_EVENTS_DEFAULT
       
The form of the Topic String is :
$SYS/Broker/<brokerName>/Monitoring/<executionGroupName>/<flowName>

Topic String in the example is $SYS/Broker/RadBroker1/Monitoring/default/MonitoringFlow
As per the above specification,the events emitted in the flow “MonitoringFlow” deployed in the ExecutionGroup “default” are published to the topic “BROKER_EVENTS_DEFAULT”.
To subscribe to the
This event data includes the payload and transaction data (i.e. what message flow, execution group, timestamp, and other useful transaction information).

1)Setup the Topic and Topic String

Subcription for this topic  will be done as below

 Without even enabling the monitoring in the toolkit and the need to redeploy the flow,we can enable
mqsichangeflowmonitoring BRK1 -e default -f MonitoringEvents_MF -s 
"QIN.transaction.start,QIN.transaction.end,QIN.transaction.rollback" -i enable
Activating Monitoring on the broker as ,
mqsichangeflowmonitoring RadBroker1 -c active -e default  –f MonitoringFlow 

To check the status of the monitoring,
mqsireportflowmonitoring RadBroker1 -e default -f MonitoringFlow  -a

Enabling statistics:
mqsichangeflowstats RadBroker1  -s -e default -f MonitoringFlow -c active -o xml

$SYS/Broker/RadBroker1/StatisticsAccounting/SnapShot/default/MonitoringFlow

Useful Links –  Event Monitoring

Setting up Event Monitoring in Message Broker version 8

Thursday, 6 March 2014

Using Shared Variables in Message Broker

Variables
The types of variables varies with Scope,Lifetime,Shared characteristics
Scope – Range (node level,flow level..)
Lifetime – Time (Lifetime for one thread)
Shared Variable:
Shared
Shared variables can be used to implement an in-memory cache in the message flow, see Optimizing message flow response times. Shared variables have a long lifetime and are visible to multiple messages passing through a flow, see Long-lived variables. Shared variables exist for the lifetime of the execution group process, the lifetime of the flow or node, or the lifetime of the node SQL that declares the variable (whichever is the shortest). Shared variables are initialized when the first message passes through the flow or node after each broker startup.
ATOMIC option of the BEGIN ... END statement. The BEGIN ATOMIC construct is useful when a number of changes must be made to a shared variable and it is important to prevent other instances seeing the intermediate states of the data.
As Shared variables can be used under one execution group for multiple instances,if we are using counter,then there is a possibility that one thread tries to overwrite the other thread.This will produce unexpected results.To avoid this,we need to make it Atomic.

For LongLived variables –We can use database.But Write access will be slow.But persistence and Transaction is good.
you cannot share variables across execution groups.
Shared variables advantages:
Hence we go for in-memory cache.R/W access is fast in the expense of shorted persistence and no transaction.
Access is direct; that is, there is no need to use a special function (SELECT) to get data, or special statements (INSERT, UPDATE, or DELETE) to modify data. You can refer to the data directly in expressions.

Long-lived data types have an extended lifetime beyond that of a single message passing through a node. Long-lived data types are shared between threads and exist for the life of a message flow
ESQL ROW Datatype
The ROW data type holds a tree structure. 
To store a message tree in a shared variable, use the ROW data type.
Shared Variable usage code:
Without Atomicity
DECLARE CountSHARED INTEGER0;
 DECLARE mySharedRowSHARED ROW;
CREATE COMPUTEMODULE SharedVariables_test_Compute
      CREATE FUNCTIONMain() RETURNS BOOLEAN
      BEGIN
            -- CALL CopyMessageHeaders();
             
       SET OutputRoot.XMLNSC.SHARE.COUNT  = Count;
     
     SET mySharedRow= THE
   (SELECT ITEM Name FROM InputRoot.XMLNSC.Student.Name[] );
  
   SET OutputRoot.XMLNSC.SHARE.Result = mySharedRow;
   SET Count=Count+1;
            RETURN TRUE;
      END;

With Atomicity
If we want to use Atomic block only in the counter increment part (Write part) but not the Read part of some Shared variable,then only the Write portion can be given as Atomic.
DECLARE CountSHARED INTEGER0;
 DECLARE mySharedRowSHARED ROW;
CREATE COMPUTEMODULE SharedVariables_test_Compute
      CREATE FUNCTIONMain() RETURNS BOOLEAN
      BEGIN ATOMIC
            -- CALL CopyMessageHeaders();
             
       SET OutputRoot.XMLNSC.SHARE.COUNT  = Count;
     
     SET mySharedRow= THE
   (SELECT ITEM Name FROM InputRoot.XMLNSC.Student.Name[] );
  
   SET OutputRoot.XMLNSC.SHARE.Result = mySharedRow;
   SET Count=Count+1;
            RETURN TRUE;
      END;


Thursday, 16 January 2014

Changing bithttplistener port

Checking the HTTPConnector default properties :
C:\Program Files\IBM\MQSI\8.0.0.3>mqsireportproperties RadBroker1 -o HTTPConnect
or -b httplistener -r


HTTPConnector
  uuid='HTTPConnector'
  address=''
  port='7080'
  allowTrace=''
  maxPostSize=''
  acceptCount=''
  bufferSize=''
  compressableMimeTypes=''
  compression=''
  connectionLinger=''
  connectionTimeout=''
  maxHttpHeaderSize=''
  maxKeepAliveRequests=''
  maxSpareThreads=''
  maxThreads=''
  minSpareThreads=''
  noCompressionUserAgents=''
  restrictedUserAgents=''
  socketBuffer=''
  tcpNoDelay=''
  enableLookups='false'

BIP8071I: Successful command completion.

Default port is 7080.

To change the bipHTTPListener port:
mqsichangeproperties RadBroker1 -b httplistener -o HTTPConnector -n port -v 7081

After this broker restart is required.
Checking the status again now ...

C:\Program Files\IBM\MQSI\8.0.0.3>mqsireportproperties RadBroker1 -o HTTPConnect
or -b httplistener -r


HTTPConnector
  uuid='HTTPConnector'
  address=''
  port='7081'
  allowTrace=''
  maxPostSize=''
  acceptCount=''
  bufferSize=''
  compressableMimeTypes=''
  compression=''
  connectionLinger=''
  connectionTimeout=''
  maxHttpHeaderSize=''
  maxKeepAliveRequests=''
  maxSpareThreads=''
  maxThreads=''
  minSpareThreads=''
  noCompressionUserAgents=''
  restrictedUserAgents=''
  socketBuffer=''
  tcpNoDelay=''
  enableLookups='false'

BIP8071I: Successful command completion.



Saturday, 11 January 2014

ANT and Message broker

What is the use of ANT?
  1. If you want to automate the complete build: build, jar,  code analysis, run the unit tests, generate the documentation, copy to some directory, tune some properties depending on the environment, etc.
  2. Any repititive tasks can be automated using ANT
  3. Once it's automated, you can use a continuous integration system which builds the application at each change or every hour to make sure everything still builds and the tests still pass...
Bar file contains broker.xml and compiled message flows and message sets.This broker.xml file contains the deployment descriptions. To modify any of its contents,in earlier versions of broker we had to use WMB toolkit or by manuall extracting broker.xml.
In later versions of 6 ,we got mqsiapplybaroverride command tool to modify broker.xml.
ANT is one of the automatic  build tools which helps in build,test,deploy of bar file automatically.


ANT uses XML as the configuration file.
Root element is Project.
Under project there are multiple TARGET  elements..TARGETs are logical units of work.
For eg:Compiling java program is one unit of work.
Within Target,there are tasks(ANT provides;Custom tasks also possible).
Good example of Custom tasks :- JUNIT tasks
Some targets may depend on other targets as well.

Ant looks for Build.xml file.
Broker.xml file
  • A broker.xml file. This file is called the broker deployment descriptor. You can have only one of these files within your BAR file. This file, in XML format, is contained in the META-INF folder of the compressed file and can be modified by using a text editor or shell script.

Opening Broker.xml file :
 Change .bar file as .zip file.Then open the .zip file and open META-INF file.And then,open broker.xml (Deployment Descriptor file) inside that.




Mqsicreatebar
Used to create deployable bar file.
If you use a repository to store your message flows and dictionaries, you can write scripts that use themqsicreatebar command and the repository's command-line tools to deploy your message flow applications.
The following example creates a BAR file called myflow.bar. The application Application1 is added to the BAR file and the trace function is activated.
mqsicreatebar -data C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New -b C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test_command.bar -a Ant_Test -trace

When executing this command ,we need to make sure that there should not be any errors in the workspace.If there are any errors,then the mqsicreatebar will not work.
[2013/12/14/15:53:00] [ERROR]  { Workspace has errors on it after the build. In
order to create bar there should be no errors on the workspace. }  - com.ibm.eto
ols.mft.bar.cmdline.MqsiCreateBarException: Workspace has errors on it after the
 build. In order to create bar there should be no errors on the workspace.
BIP0965E Error compiling files in mqsicreatebar.
To find the build errors,during mqsicreatebar(Note : mqsicreatebar is part of Toolkit installed path  “C:\Program Files\IBM\WMBT800” ;Hence it is related to toolkit)
The build error logs is in the path “C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments\.metadata”  ,where C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments\ is the workspace name.
If the command is successfully completed,then BIP0986I Command completed successfully. Should come.Else,then if the errors are due to current workspace,take the Project to new workspace and use mqsicreatebar.

ANT initial setup :
1)First download apache ant  from http://ant.apache.org/bindownload.cgi
2)Then setup the below variables.So,you can run ANT from any path,
set ANT_HOME= E:\Softwares\apache-ant-1.9.21
set JAVA_HOME= C:\Program Files\Java\jdk1.6.0
set PATH= E:\Softwares\apache-ant-1.9.2\bin

C:\Users\Radha>echo %JAVA_HOME%
C:\Program Files\Java\jre7\bin;C:\Program Files\Java\jdk1.6.0;
Troubleshooting tip
The installer for 1.6 dropped java.exe, javaw.exe, and javaws.exe into my Windows/System32 folder (Windows 7).
I solved it by renaming those files to java_wrong.exe, javaw_wrong.exe, and javaws_wrong.exe. Only after doing that does it pick up the correct version of java as defined in JAVA_HOME and PATH.

Running simple Ant project :-
In E:\Techie\Ant , a build.xml file is created with the following content.Make sure that the file is really build.xml and not build.xml.txt
<project name="Ant" default="target1">
 <target name="target1">
  <echo>This is my first project</echo>
</target>
</project>
Output:


Simple build.xml for creating bar file
<?xml version="1.0"?>
<project name="Ant_WMB_First" default="run">

 <target name="run" description="">
  <property name="toolkit.home" value="C:\Program Files\IBM\WMBT800"/>
<property name="workspaces.dir" value="C:\Users\Radha\IBM\wmbt80\Workspace
\Rad_Experiments_New" />
<property name="bar.name" value="${workspaces.dir}\Ant_Test_command.bar"/>
 
<antcall target="mqsicreatebar.buildbar"/>
</target>

<target name="mqsicreatebar.buildbar">
 <echo message="Building broker archive file : ${bar.name} "/>
 <exec executable="${toolkit.home}\mqsicreatebar.exe" spawn="false">
 <arg value="-data" />
<arg value="${workspaces.dir}" />

<arg value="-b" />
<arg value="${bar.name}" />

<arg value="-a" />
<arg value="Ant_Test" />
</exec>
<echo message="completed building broker archive file :- ${bar.name}" />
</target>
</project>

Mqsiapplybaroverride :
The below extract taken from broker.xml file which is present inside the bar file created by the execution of above ANT command.
<ConfigurableProperty override="IN1" uri="Ant_Test#MQ Input.queueName"/>

Command sample :
mqsiapplybaroverride -b C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test_command.bar  -p C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test.properties.txt

mqsiapplybaroverride –b C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test_command.bar  –m Ant_Test#MQInput.queueName=IN_Test

Now to override the Input Queue IN1 by IN_Test.Have the below content in properties file.
#If want to replace a specific URI override value within the broker.xml
#URI_<uri with # escaped with a backslash \>=<new override value>
URI_PostcardFlow\#additionalInstances=2
 
#Replace all places in broker.xml that have IQ as a override value with
<old override value>=<new override value>
Q1=TEST_QUEUE

URI_ Ant_Test\# MQ Input.queueName= IN_Test
The correct command for application applybaroverride .This has to be applied in WMB toolkit version 8.0.0.3.
 mqsiapplybaroverride -b C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test_command.bar  -k  Ant_Test -o C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test_command_changed.bar   -p  C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test.properties.txt

Execution of the command:
C:\Program Files\IBM\MQSI\8.0.0.3> mqsiapplybaroverride -b C:\Workspace\Ant_Test_command.bar -k Ant_Test -o C:\Workspace\Ant_Test_command_changed.bar - 
p C:\Workspace\Ant_Test.properties 
BIP1138I: Applying overrides using runtime mqsiapplybaroverride... 
BIP1140I: Overriding property Ant_Test#additionalInstances with '10' in 'Ant_Tes 
t.appzip/META-INF/broker.xml' ... 
BIP1143I: Saving Bar file C:\Workspace\Ant_Test_command_changed.bar... 

BIP8071I: Successful command completion. 
To override a property use the same structure as that of the output of mqsireadbar :
mqsireadbar -b C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test_command.bar –r

Now,in build.xml I am giving the content for mqsiapplybaroverride as :-
<?xml version="1.0"?>
<project name="project" default="run">
  <target name="run" description="">
    <property name="toolkit.home" value="C:\Program Files\IBM\WMBT800" />
    <property name="ant.bars.basedir" value="C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New" />
    <property name="bar.name" value="${ant.bars.basedir}\Ant_Test_command.bar" />
    <property name="app.name" value="Ant_Test" />
    <property name="bar.properties.name"
                                             value="${ant.bars.basedir}\Ant_Test.properties" />

    <antcall target="mqsiapplybaroverride.modifybar" />
  </target>

  <!--
    Target to build the broker archive using mqsiapplybaroverride
  -->
  <target name="mqsiapplybaroverride.modifybar">
    <echo message="Applying overrides in Broker Archive file - ${bar.name} " />
    <echo
      message="${toolkit.home}\mqsiapplybaroverride.exe
                                               -b  ${bar.name} -p ${bar.properties.name}" />
    <exec executable="${toolkit.home}\mqsiapplybaroverride.exe" spawn="false">
      <arg value="-b" />
      <arg value="${bar.name}" />
      <arg value="-k" />
      <arg value="${app.name}" />
      <arg value="-p" />
      <arg value="${bar.properties.name}" />
    </exec>
    <echo message="Completed apply overrides in Broker Archive file - ${bar.name}" />
  </target>
</project>

Properties file contain:
Ant_Test#additionalInstances=10
Ant_Test#MQ Input.queueName = IN_Test

Mqsideploy
Deploying:
mqsideploy RadBroker1  -e default -a C:\Users\Radha\IBM\wmbt80\Workspace\Rad_Experiments_New\Ant_Test_command.bar  -w 600 

Undeploying :
mqsideploy RadBroker1  -e default -d Ant_Test -w 600 

Hint on mqsiprofile
If you try to run a command like ‘mqsireportproperties'and got the error below you need to run mqsiprofile BEFORE you run your command.
The user environment was not adequately prepared to continue execution. Locate and run the profile supplied with the product. This file is called mqsiprofile, and is located in the bin subdirectory for the product.
1
2
3
4
SET "BROKER_HOME=C:\Program Files\IBM\MBroker\7.0"
SET "path=%path%;%BROKER_HOME%\bin"
mqsiprofile
mqsireportproperties MB7BROKER -e EXECUTIONGROUP-o HTTPConnector -r

To run mqsi commands,mqsiprofile command has to be initially run to get some broker Environment variables.When WMB software is installed,and broker is started using mqsistart command,it tries to inherit the environment from where we issue the mqsistartcommand.

Therefore ,we need to initialise the environment before we start a component. the command mqsiprofile located in the directoryinstall_dir/bin, performs this initialization. 

Mqsideploy-Ant
<?xml version="1.0"?>
<project name="project" default="run">
  <target name="run" description="">
    <property name="toolkit.home" value="C:\Program Files\IBM\WMBT800" />
     <property name="mqsi.home" value="C:\Program Files\IBM\MQSI\8.0.0.3\bin" />
    <property name="ant.bars.basedir" value="C:\Users\Radha\IBM\wmbt80\Workspace
\Rad_Experiments_New" />
    <property name="bar.name" value="${ant.bars.basedir}\Ant_Test_command.bar" />
    <property name="app.name" value="Ant_Test" />
  <property name="broker.name"
                                    value="RadBroker1" />
<property name="EG.name" value="default" />
    <antcall target="mqsideploy.bar" />
  </target>

  <!--
    Target to deploy using mqsideploy
  -->
  <target name="mqsideploy.bar">
    <echo message="Deploying  - ${bar.name} " />
    <echo
      message="${mqsi.home}\mqsideploy  ${broker.name} -e ${EG.name}
                                      -a  ${bar.name} -w 600" />
    <exec executable="${mqsi.home}\mqsideploy.exe" spawn="false">
      <arg value="${broker.name}" />
     
      <arg value="-e" />
       <arg value="${EG.name}" />


      <arg value="-a" />
      <arg value="${bar.name}" />

      <arg value="-w" />
      <arg value="600" />
     
    </exec>
    <echo message="Completed deploy - ${bar.name}" />
  </target>
</project>

Mqsipackagebar
Use the mqsipackagebar command to create deployable broker archive (BAR) files. You can use this command to create BAR files on machines that do not have the WebSphere  Message Broker Toolkitinstalled.

Resources that you add to a BAR file by using the mqsipackagebar command are not compiled when they are added. To deploy a BAR file that you create by using this command, you must add deployable resources to the BAR file. For example, if you want to include Java code or message sets in your BAR file, you must first compile these files before you use the mqsipackagebar command to add them to your BAR file. You cannot include both the compiled (.cmf) and source (.msgflow) versions of a message flow in a BAR file.

I had an application with a JCN node.Hence the application has project reference with a java project.
I have first compiled the JCN’s java project and it got converted to .jar file.

Then I executed  mqsipackagebar for the entire application.

Monday, 16 December 2013

What is URL Encoding?
When you pass information through a URL, you need to make sure it only uses specific allowed characters like: alphabetic characters, numerals, and a few special characters that have meaning in the URL string. Any other characters should be encoded so that they don't cause problems.
The most commonly encoded character is the <space> character. You see this character whenever you see a plus-sign (+) in a URL. This represents the space character. The plus sign acts as a special character representing a space in a URL. The most common way you'll see this is in a mailto link that includes a subject. If you want the subject to have spaces in it, you can encode them as pluses:
mailto:email?subject=this+is+my+subject
How Do You Encode a URL?
Simply replace the special characters with their encoding string. This will nearly always begin with a %. If you don't want to do it by hand, you can use a script such as is found on the JavaScript site: Encoding Web Addresses.
How URL_Decoding can be done in Message Broker?
     I.        When the HTTP client sends the Request-Type as “GET” and the Content-type as “URL-Encoded”,then our Message broker HTTPInput node by itself can decode the url-encoded input message .
To extract the decoded message ,we have to enable the “parseQueryString” property in the HTTPInput node as below.
Then the decoded message will be present in the below path.We can extract the message from this path for further use.
For eg:
SET Environment.Variables.OriginalMessage = CAST(InputLocalEnvironment.HTTP.Input.QueryString.Input AS BLOB CCSID 1208);
   II.        When the HTTP client sends the Request-Type as “POST” and the Content-type as “URL-Encoded”,then our Message broker HTTPInput node cannot by itself decode the url-encoded input message .
The following method can be used to achieve such scenarios.
Introduce a “Javacompute node” after HTTPInput node.
String result =  java.net.URLDecoder.decode("=%3cn%3aMessage+xmlns%3an%3d%22http%3a%2f%2f%3e%5d%5d%3e%3c%2fMsg%3e%3c%2fn%3aMessage%3e", "UTF-8");
Refer the message in a variable or directly as shown in the above example.
Note : No need for checking “parseQueryString” option in HTTPInput node.


HTTP URL Encoding

Encoding Vs Encryption Encoding is the process of transforming data so that it may be transmitted without danger over a communication channel or stored without danger on a storage medium. For instance, computer hardware does not manipulate text, it merely manipulates bytes, so a text encoding is a description of how text should be transformed into bytes. Similarly, HTTP does not allow all characters to be transmitted safely, so it may be necessary to encode data using base64 (uses only letters, numbers and two safe characters). When encoding or decoding, the emphasis is placed on everyone having the same algorithm, and that algorithm is usually well-documented, widely distributed and fairly easily implemented. Anyone is eventually able to decode encoded data. Encryption, on the other hand, applies a transformation to a piece of data that can only be reversed with specific (and secret) knowledge of how to decrypt it. The emphasis is on making it hard for anyone but the intended recipient to read the original data. An encoding algorithm that is kept secret is a form of encryption, but quite vulnerable (it takes skill and time to devise any kind of encryption, and by definition you can't have someone else create such an encoding algorithm for you - or you would have to kill them). Instead, the most used encryption method uses secret keys : the algorithm is well-known, but the encryption and decryption process requires having the same key for both operations, and the key is then kept secret. Decrypting encrypted data is only possible with the corresponding key. See encoding as a way to store or communicate data between different systems. For example, if you want to store text on a hard drive, you're going to have to find a way to convert your characters to bits. Alternatively, if all you have is a flash light, you might want to encode your text using Morse. The result is always "readable", provided you know how it's stored. Encryption means you want to make your data unreadable, by encrypting it using an algorithm. For example, Caesar did this by substituting each letter by another. The result here is unreadable, unless you know the secret "key" with which is was encrypted. Encoding Vs Compression Encoding is representing a piece of information in other form. Say for example, one can represent 10 as 0xA. This is hexadecimal encoding. Compression is done solely to lessen the number of symbols to represent given piece of information. It is achieved with the help of specific encoding of information. Encoding is used at various places but audio/video encoding is more known encoding to us. This leads to this confusion. As different types of encoding gives different types of compression, it combines encoding & compression. But encoding doesn't always compress the data. Those examples are in communication theory. NRZ & NRZI are example of encoding which doesn't compress data. In MQInput node,we can easily do the encoding setup by setting the below properties At HTTP node,we can do Compression (Compression is the only Encoding that can be done at HTTPInput node). What is URL Encoding? When you pass information through a URL, you need to make sure it only uses specific allowed characters like: alphabetic characters, numerals, and a few special characters that have meaning in the URL string. Any other characters should be encoded so that they don't cause problems. The most commonly encoded character is the character. You see this character whenever you see a plus-sign (+) in a URL. This represents the space character. The plus sign acts as a special character representing a space in a URL. The most common way you'll see this is in a mailto link that includes a subject. If you want the subject to have spaces in it, you can encode them as pluses: mailto:email?subject=this+is+my+subject How Do You Encode a URL? Simply replace the special characters with their encoding string. This will nearly always begin with a %. If you don't want to do it by hand, you can use a script such as is found on the JavaScript site: Encoding Web Addresses. How URL_Decoding can be done in Message Broker? I. When the HTTP client sends the Request-Type as “GET” and the Content-type as “URL-Encoded”,then our Message broker HTTPInput node by itself can decode the url-encoded input message . To extract the decoded message ,we have to enable the “parseQueryString” property in the HTTPInput node as below. Then the decoded message will be present in the below path.We can extract the message from this path for further use. For eg: SET Environment.Variables.OriginalMessage = CAST(InputLocalEnvironment.HTTP.Input.QueryString.Input AS BLOB CCSID 1208); II. When the HTTP client sends the Request-Type as “POST” and the Content-type as “URL-Encoded”,then our Message broker HTTPInput node cannot by itself decode the url-encoded input message . The following method can be used to achieve such scenarios. Introduce a “Javacompute node” after HTTPInput node. String result = java.net.URLDecoder.decode("=%3cn%3aMessage+xmlns%3an%3d%22http%3a%2f%2f %3e%5d%5d%3e%3c%2fMsg%3e%3c%2fn%3aMessage%3e", "UTF-8"); Refer the message in a variable or directly as shown in the above example. Note : No need for checking “parseQueryString” option in HTTPInput node.