Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jacky_Liu
Product and Topic Expert
Product and Topic Expert
3,956
Today one customer called a soap api from a third party system. Some important information is in attachment of the soap message . Customer needs to extract message in soap message attachment . I had some test and successfully extract the data from soap message . Let me share the steps, which may help others .

I support the readers has installed Soap UI.

Let me share the steps :

 

Step 1 , Develope and deploy iflow in CPI .


Develope iflow




 

 
/* Refer the link below to learn more about the use cases of script.
https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/148851bf8192412cba1f9d2c17f...

If you want to know more about the SCRIPT APIs, refer the link below
https://help.sap.com/doc/a56f52e1a58e4e2bac7f7adbf45b2e26/Cloud/en-US/index.html */
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {

//Attach
def attach = message.getAttachments();
def datahandler = attach.values()[0];
def content = datahandler.getContent();

def messageLog = messageLogFactory.getMessageLog(message);
if(messageLog != null){
messageLog.setStringProperty("Logging", "Printing Payload As Attachment");
messageLog.addAttachmentAsString("Message#2", content.toString(), "text/plain");
}
message.setBody(content);
return message;
}

After depoyment , we can find the iflow runtime URL and download the wsdl file with following screen shot .


 

Step 2, Test with Soap UI .


Get  CPI runtime  Client ID and Client Secret from CPI runtime instance service key



Test with Soap UI




We can find that the attachment content has been successfully extracted into response body .

 

Then End

 

Best regards!

 

Jacky Liu
5 Comments