Introduction #
A synchronous call consists of a request (outbound message) and a response (inbound message) which builds a logical unit and pair. The nature of a real synchronous call is that it happens within an HTTP callout and while the callout takes place the process is waiting until the response is delivered. As long as the response is not delivered the user transaction or the apex transaction is a block. The apex transaction will wait until it gets a timeout. Unlike this, the asynchronous call is fire and forget and doesn’t wait for a response. Even the service could return a response it will not wait and the apex calling transaction is immediately free and not blocked. This is the technical view.
For example: For the user who uses a real-time scenario or transaction like checking the available seat in a cinema or in flight, they want to see the result immediately and they are waiting to see the response on their screen. If they do not get a result then they will issue the request again. This means that they don’t need a monitor to reprocess a failed request. A failed synchronous request doesn’t necessarily need to reprocess by an admin using a message monitor. This is not the correct way. If the request fails the user will do it again from their screen. Because of this nature normally, synchronous calls do not need to persist message for reprocessing. Reprocess is needed for asynchronous messages.
Pre-requisite:
- We have to create Integration.
- Create SFDC2SAPPI adapter
- We have to create two interfaces where one should inbound interface and the other is an outbound interface.
How to Handle requests and responses as a transaction for a synchronous call? #
We need two interface one is inbound and the other is outbound. Outbound interface for request calling and inbound interface for responding.
step1:
- Create an outbound interface for request calling
- Create an inbound interface for responding
- Enter adapter (SFDC2SAPPI) for Outbound Adapter
- Enter inbound interface Id for Invoke Outbound/Inbound Interface
- Do mapping for the outbound interface.
- Do mapping in the inbound interface to respond data from SAP come back in Skyvva
step2:
Navigate to Setup => Developer Console => Open Execute Anonymous Window after that use method InvovkeCallOut2 to data.
Here is Method InvovkeCallOut2:
skyvvasolutions.CallOutControl c=new skyvvasolutions.CallOutControl();
c.returnxml=true;
c.returnListRecord=true;
c.iscreatemessage=true;
skyvvasolutions.IServices.invokeCallout2(‘InvokeCallOut’,’AccountRequest’,new String[]{‘0011j0000063flLAAQ’}, ‘SYNC’, c);
The result on message monitoring after executed