Monday, 11 December 2017

Populating Destination in the local environment tree

Use the Destination subtree to set up the target destinations that are used by output nodes, the HTTPRequest node, the SOAPRequest node, the SOAPAsyncRequest node, and the RouteToLabel node.

Adding a queue name for the MQOutput node with the Destination Mode property set to Destination List

SET OutputLocalEnvironment.Destination.MQ.DestinationData[1].queueName = newQueue;

Changing the default URL for a SOAPRequest node or a SOAPAsyncRequest node request

SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = newUrl;


Changing the default URL for an HTTPRequest node request

 SET OutputLocalEnvironment.Destination.HTTP.RequestURL = newUrl;

Adding a label for the RouteToLabel node

SET OutputLocalEnvironment.Destination.RouterList.DestinationData."label" = newLabel;


N.B. newUrl can be a user defined property.

Extract from IBM Information Center

Friday, 17 November 2017

ESQL Functions

UUIDASCHAR
A function that returns a universally unique identifiers (UUID) as a CHARACTER value.

DECLARE uuid CHAR;

SET uuid =  UUIDASCHAR(source_blob_uuid);
SET uuid =  UUIDASCHAR;

If (source_blob_uuid) is not specified, UUIDASCHAR creates a UUID and returns it as a CHARACTER value. ed.
If (source_blob_uuid) is specified, UUIDASCHAR converts an existing BLOB UUID to the character form.

The result is NULL if a NULL parameter is supplied.

Friday, 10 November 2017

ESQL Arrow Notation


The arrow notation (the greater than (>) and less than (<)
symbols) is used to indicate the direction of search and the index to be specified:

SET OutputRoot.DFDL.MyMessage.StringElement1[>] = 'This is the first occurrence of StringElement1';
SET OutputRoot.DFDL.MyMessage.StringElement1[<2] = 'This is the last but one occurrence of
 StringElement1';
SET OutputRoot.DFDL.MyMessage.StringElement1[<1] = 'This is the last occurrence of StringElement1';

You can refer to the last instance of a repeating field using the special [<] array index, and to instances relative to the last (for example, the second to last) as follows:

Field[>] indicates the first element. This is equivalent to Field[1].
Field[<] indicates the last element.
Field[<1] indicates the last element.
Field[<2] indicates the last but one element (the penultimate element).
You can also use the array index [>] to represent the first element, and elements relative to the first element in a similar way.

Friday, 3 November 2017

Create an XMLNSC Tree in ESQL

CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC'; 
CREATE LASTCHILD OF OutputRoot.XMLNSC NAME 'FileData'; 
CREATE FIRSTCHILD OF OutputRoot.XMLNSC.FileData NAME 'BlobPayload' value InputRoot.BLOB.BLOB; 
CREATE LASTCHILD OF OutputRoot.XMLNSC.FileData NAME 'Filename' VALUE InputLocalEnvironment.File.Name;
CREATE LASTCHILD OF OutputRoot.XMLNSC.FileData NAME 'Filedir' VALUE InputLocalEnvironment.File.Directory;

The above code will create the following XML payload.

<FileData>
   <BlobPayload>XXX</BlobPayload>
   <Filename>YYY</Filename>
   <Filedir>ZZ</Filedir>
</FileData>

Monday, 30 October 2017

WebSphere MQ Misc

WeSphere MQ error files (AMQ*.FDC) are kept in C:\Program Files (x86)\IBM\WebSphere MQ\errors


Monday, 23 October 2017

Configuring a message flow for identity propagation

To enable a message flow to perform identity propagation, the input nodes must extract the identity from the message flow and the output node must propagate it. If the message identity does not contain enough information for identity propagation, you can provide the identity to propagate.

Before you can configure a message flow to perform identity propagation, you must check that an appropriate security profile exists, or create a new security profile


Creating a security profile 


Using the command console, run the following command:

              mqsicreateconfigurableservice broker_name -c SecurityProfiles -o securityProfileName -n                 "propagation,idToPropagateToTransport,transportPropagationConfig" -v "TRUE,STATIC                    ID,securityIDName"

Using the IIB Web user Interface:

Select IIB Node-->Operational Policy-->Confugarable Services.

Create new Confugarable Service.

Choose SecurityProfiles type


 
Stop the broker.
Start the broker.

Enabling identity propagation
An input node extracts security tokens if it is configured with a security profile at deployment time. An output node propagates an identity if it is configured with a security profile that enables propagation at deployment time.
To enable a message flow to perform identity propagation, complete the following steps.
By using the BAR editor, select a security profile that has identity propagation enabled. You can set a security profile on a message flow or on individual input and output nodes. If no security profile is set for the input and output nodes, the setting is inherited from the setting on the message flow.
  1. In the Application Development view, right-click the BAR file, then click Open with > BAR Editor.
  2. Click the Manage and Configure tab. In IIB 10 Click the Manage tab.
  3. Click the flow or node on which you want to set the security profile. The properties that you can configure for the message flow or for the node are displayed in the Properties view. In IIB 10 click on the Resources folder to select the flow or node.
  4. In the Security Profile Name field, select a security profile that has identity propagation enabled.
  5. Save the BAR file.

Friday, 6 October 2017

Change and style blogger read more link

To insert a 'read more' jump link, click the little broken page icon .

To style the jump link do the following:-

Edit HTML.
Ctrl + F to find the 'jump-link' text.


Chnage the highlighted '<data:post.jumpText/>' to 'Continue reading...'

Save your theme.

ESQL Code Snippets

1. Convert XMLNSC to BLOB 

Sometimes you may need to convert your payload to a BLOB(Binary Large Object). To be able to accomplish this the ASBITSTREAM function has to be used. The ASBITSTREAM function will return a bit stream representation of your payload. When I need to put my payload to MQ queue I convert it to a BLOB.
 DECLARE myChar CHAR CAST(myBLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);  

2. Convert BLOB to CHAR

 DECLARE myChar CHAR CAST(myBLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);  

3. Convert CHAR to BLOB

 DECLARE myBlob BLOB CAST( myChar AS BLOB CCSID InputRoot.Properties.CodedCharSetId);  

4. Convert BLOB to XMLNSC 

 CREATE LASTCHILD OF OutputRoot.XMLNSC DOMAIN('XMLNSC') PARSE(myBlob, InputRoot.Properties.Encoding, InputRoot.Properties.CodedCharSetId);  

5. Left Padding

 RIGHT('0000000000' || CAST(field AS CHAR),10);  
The above will left zero pad field to a 10 long field.


6. Nil Element & Namespace Declaration

 SET OutputRoot.XMLNSC.ns:myElement.(XMLNSC.NamespaceDecl)xmlns:"xsi" ='http://www.w3.org/2001/XMLSchema-instance';    
 SET OutputRoot.XMLNSC.ns:myElement.(XMLNSC.Attribute)xsi:nil = 'true';   

7. Convert Payload to a String

 DECLARE myBlob BLOB;  
 SET myBlob = ASBITSTREAM(InputRoot.XMLNSC CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding);  
 DECLARE myChar CHAR CAST(myBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);  

8. Backup a JSON Payload without losing arrays

 CREATE LASTCHILD OF OutputRoot DOMAIN('JSON') TYPE Name NAME 'JSON';  
 CREATE FIELD OutputRoot.JSON.Data IDENTITY(JSON.Object)Data;  
 SET OutputRoot.JSON.Data = InputLocalEnvironment.Backup.Data;   

9.Pass Parameters to an HTTP request Node 

 OutputLocalEnvironment.Destination.HTTP.QueryString.param1 = 'param1';  
Each parameter must be individually set.

10. Convert BLOB to JSON 

 CREATE LASTCHILD OF OutputRoot DOMAIN('JSON') PARSE(InputRoot.BLOB.BLOB);  

11. Select value from an ESQL array 

This statement allows you to select the name without iterating through OutputLocalEnvironment.Variables.Person[] where the Id value matches the nameId.

 SET name = the(select item fieldvalue(r.Name) from OutputLocalEnvironment.Variables.Person[] as r where r.Id = nameId);   


You may be interested in the following posts:

Good IIB ESQL Coding Practice

Properties versus MQMD folder behavior

Create a JSON Array in IBM Integration Bus

Wednesday, 4 October 2017

Create an SAP Adapter in WebSphere Integration Bus

Before you can develop message flows that use WebSphere SAP Adapter nodes, you must add prerequisite files to the runtime environment.

Ensure that you have the following files .
sapidoc3.jar
sapjco3.jar
sapjco3.dll

Save these files in a library e.g. C:/SAP_LIB

These files are available from the SAP Service Marketplace - . You must have an SAPNet account to be able to access this web site.

Friday, 7 July 2017

MQSI Commands

List installed brokers and their associated resources
e.g. mqsilist -d0 - lists all brokers.

0 returns only broker name and the names of their associated queue managers
Note that while they are starting, execution groups might report a PID of 0.
1 returns a one-line summary of each resource.
2 returns detailed information about each resource

Clear global cache
mqsicacheadmin integration node -c clearGrid -m cache name

Wednesday, 21 June 2017

How to create a SOAP Fault in ESQL

A SOAP Fault is used to carry error information in a SOAP message.

A SOAP Fault has the following elements:

  • <faultcode> - mandatory element which provides information about the fault in a form that can be processed by the software. The values are:-
    • SOAP-ENV:VersionMismatch - invalid namespace for SOAP envelope.  
    • SOAP-ENV:MustUnderstand - a header was received that was targeted at the receiving node, marked mustUnderstand="true", and was not understood.
    • SOAP-ENV:Client - something went wrong on the receiver while processing the message, The message was incorrectly formed or contained incorrect. e..g the message could lack the proper authentication or payment information.The message was incorrectly formed or contained incorrect information.
    • SOAP-ENV:Server - There was a problem with the server, so the message could not proceed.The message could not be processed for reasons attributable to the processing of the message rather than to the contents of the message itself.
  • <faultstring> - mandatory element that provides information about the fault in a form intended for a human reader. 
  • <faultactor> - this element is intended to provide information about who caused the fault to happen within the message path. It is similar to the SOAP actor attribute but instead of indicating the destination of the header entry, it indicates the source of the fault. The value of the faultactor attribute is a URI identifying the source. Applications that do not act as the ultimate destination of the SOAP message MUST include the faultactor element in a SOAP Fault element. The ultimate destination of a message MAY use the faultactor element to indicate explicitly that it generated the fault 
  • <detail> - the element carries application-specific error information related to the <Body> element. It must be present if the contents of the <Body> element were not successfully processed.

Add the following code to a Compute node and then wire the SOAPInput node's catch terminal to the Compute node's in terminal.

DECLARE soapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/'; 
SET OutputRoot.XMLNSC.soapenv:Envelope.(XMLNSC.DoubleNamespaceDecl)xmlns:soap = soapenv; SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.faultcode = faultCode
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.faultstring = faultString
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail = detail;








Tuesday, 20 June 2017

Monday, 19 June 2017

Debugging a Java Compute Node

Run in IBM Integration console
mqsichangeproperties integration ode -e integration server -o ComIbmJVMManager -n jvmDebugPort -v port

To disable the java debug just type the same command and replace the debugging port with 0 (number zero).

Do the same when you get an error that a port is being used.

User or Service Trace

Run in IBM Integration Console
Delete old trace logs
mqsichangetrace integration node -u -e integration server -r
e.g. mqsichangetrace IB10NODE -u -e default -r

User Trace
Start trace
mqsichangetrace integration node -u -e integration server -l debug –r
This will start user trace on an integration server.
e.g. mqsichangetrace IB10NODE -u -e default-l debug –r

mqsichangetrace integration node -u -e integration server -f message flow -l debug –r
This will start user trace on a message flow.

(remove –r when running for 1st time otherwise the command fails)

Retrieve the trace log for the specified component.
mqsireadlog integration node -u -e integration server -o C:\Temp\Trace.xml
e.g. mqsireadlog IB10NODE -u -e default-o C:\Temp\Trace.xml
This command will read the log and generate an xml file with all the details, to get a more readable log file we need to use.

Stop user trace
mqsichangetrace integration node -u -e integration server -l none mqsichangetrace -u -e integration server -f message flow -l none
e.g. 
mqsichangetrace IB10NODE -u -e default-l none

Format XML tracefile
mqsiformatlog -i inputfilename -o outputfilename
e.g mqsiformatlog -i C:\Temp\trace.xml -o C:\Temp\formattrace.log
The mqsiformatlog command interprets an input log file that has been created on any system in a platform-independent code page, utf-8. Use this command to produce formatted output from input log files transferred from other systems to the system on which you issue the command. If you use this facility, ensure that you use a file transfer program that does not convert the data (for example, by specifying a binary transfer option).


Service Trace

Start trace
mqsichangetrace integration node -t -e integration server -l debug -r -c 100000

Initiate process that cause the failure to occur.

Stop trace
mqsichangetrace integration node -t -e integration server -l none

Retrieve the trace log for the specified component
mqsireadlog integration node  -t -e integration server -f -o C:\Temp\flowtrace.xml

Format the XML trace file
mqsiformatlog -i C:\Temp\flowtrace.xml -o C:\Temp\serviceflowtrace.txt