Friday 12 March 2021

Script to pick the week day






import com.sap.it.api.mapping.*;

import java.util.Date;

import java.util.Calendar

import java.text.SimpleDateFormat


def String customFunc(String arg1){


//Calendar cal = Calendar.getInstance();

//int dayOfMonth = cal.get(Calendar.DAY_OF_WEEK);
//arg1 = String.valueOf(dayOfMonth);

Calendar cal = Calendar.getInstance();

int day = cal.get(Calendar.DAY_OF_WEEK);

if (day >= Calendar.MONDAY && day <= Calendar.THURSDAY){

arg1 = true;

}else{

arg1 = false;

}






return arg1

}


Random UUID generator in SAP CPI

 Groovy script:


import com.sap.it.api.mapping.*;

def String customFunc(String arg1){

def randomID = UUID.randomUUID().toString().replace("-", "").toUpperCase();

return randomID

}


Monday 8 March 2021

Basics: SOAP vs HTTP vs REST

SOAP :Simple Object Access Protocol vs REST:


SOAP - XML-based messaging protocol for exchanging information among computers.

SOAP needs more bandwidth for its usage whereas REST doesn't need much bandwidth

SOAP only works with XML formats whereas REST work with plain text, XML, HTML and JSON.

SOAP is a protocol whereas REST is an architectural pattern.

SOAP cannot make use of REST whereas REST can make use of SOAP.

Ease of coding – Coding REST Services and subsequent implementation is far easier than SOAP.

Protocol means - set of rules that determine how data is transmitted between different devices.


SOAP vs HTTP:
S.No.    SOAP    HTTP
1.SOAP stands for Simple Object Access Protocol.HTTP stands for Hypertext Transfer Protocol.
2.It is XML based used for sending and receiving messages.It is used to transfer information over the internet.
3.It supports web socket or WS-Addressing, WS-Security, SwA.It do not supports web socket or WS-Addressing, WS-Security, SwA.
4.HTTP is over TCP and IP.SOAP is over HTTP.
5.It support runtime checking against WSDL.It do not support runtime checking against WSDL.
6.It support Automatic processing of Message Transmission Optimization Mechanism (MTOM).It also support MTOM, but it must use the MIME message domain and design flow should be done to handle the attachments explicitly.
7.This protocol’s design is Data centric.This protocol’s design is Document centric.
8.It is a light weight data interchange protocol.It is not light weight data transfer protocol as SOAP.





Sunday 7 March 2021

CPI search using ID's

 

We would need to implement this feature in CPI to search on any specific Key ID’s like CustomerID, TicketID. So we will utilize this below.

 

Challenges:

As of now finding the specific data in CPI using any ID search is not implemented, as we search using timing and it is very difficult for us to find it if there are several message on every secs.

 

Solution:

 

Interface implementation: