Skip to Content
Technical Articles
Author's profile photo Raviteja Satuluri

Splitting of SOAP Based XML Message and Attachment to send to multiple receivers from Cloud Platform Integration

Introduction:

One of the feature in cloud platform integration is message routing according to customer needs. We will face some issues while building our scenario, how to send and split a message in case of any attachment.

Here I am going to give you an idea, how to split attachment and how to send a message to multiple end points or multiple receivers.

Problem Description:

We have a requirement where external Web Service application system is sending a Soap based XML message by attaching a PDF file. This PDF file is need to send 3rd party application via email communication for their validation purpose as an attachment.

Prerequisites : You should have CPI tenant access.

You will get target email adapter configuration details from your client and configure accordingly in the channel.

This document will give you an idea how to get Soap attachments.

Step 1: Please use 3rd party tool Soap UI for testing purpose. Load your WSDL and sample XML data along with an PDF attachment.

If you want to send a test message, you need to provide Basic Authentication details in SOAP UI tool before sending message.

PFB Screenshot:

Step 2: Build your Integration Components in CPI.

a) Configure Soap sender channel

These details you will get from your source application team. Get the WSDL and import it in to you sender soap channel configuration. once you uploaded WSDL file, few of fields will update automatically in the channel configuration, those are nothing but URL to WSDL, Service, Endpoint and Operation Name.

You can check the connectivity from Connectivity test tab.

if you are following certificate based authentication, you will find the source application certificate from connectivity test results, download it and deploy in CPI.

Similarly share CPI certificate to Source team to deploy at their end for exchange of messages from Source system to CPI.

b) Use Sequential Multicast which will help you to send a same message to different end points.

c) Groovy script used to get PDF attachment from SOAP Message sending by Source application system.

Groovy Script:

import com.sap.gateway.ip.core.customdev.util.Message
import java.util.Map
import java.util.Iterator
import javax.activation.DataHandler

def Message processData(Message message)
{
//message.getContent();
//message.setBody(message.getContent());
Map<String, DataHandler> attachments = message.getAttachments();
if (attachments.isEmpty()) {
throw new Exception(“No Attachments !!”); // Handling of missing attachment goes here
} else {
//Handling of available attachments
attachments.values().each{ attachment ->
if(attachment.getContentType().contains(“pdf”)){
message.getAttachments();
}
}
}
return message;
}

d) Use Execution Sub process to catch exception messages.

e) Configure your email receiver channels. In our case

One mail receiver channel is configured to send PDF attachment

Another mail receiver channel is configured to send email Alert notification to client folks in case if any failure messages.

 

PFB Screenshot.

 

Step 3: Trigger a test message from Soap UI tool.

If everything configured correctly you will get successful response message like below. Please find below screenshot.

 

Step 4: Please go and check your Monitoring page.

 

Step 5: For our testing purpose i have configured gmail account details to check if PDF attachment is stepped out of from CPI and able to reach given destination. In our case we got attachment successfully with out any issues.

 

 

Conclusion: Finally this documents gives an initiative for beginners, how to use Sequential Multicast and how to get attachments.

Note : I am very new to CPI technology. Hope this blog will help for beginners.

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.