cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in Synchronous SOAP Communication channel

Former Member
0 Kudos

hi Experts,

I stuck in one scenario where my requirment is:--

At Receiver side SOAP adapter(which is Synchronous Communication) accepts data as Attachment.

But the response mustn't be in form of attachment.

If i use Keep Attachment at SOAP receiver channel, I will get response in the form of Attachment which doesn't meet my requirment.

Is it possible to extract the data from attachment.

I used PayloadSwapBean Module at SOAP receiver side but still I am getting response as Attachment.

Please help me out.

Is there any other approch for my Requirment which is as follows:---

FTP--->SOAP request(as an Attachment) >SOAP response(Without Attachment)->FTP

Solutions will be awarded with points:)

Thanks,

Jaideep Jain

Accepted Solutions (1)

Accepted Solutions (1)

sunil_singh13
Active Contributor
0 Kudos

Hi Jaydeep,

The other way is to develope the develope our own Module.

As you are using SOAP in sych ( you are using it as Receiver adapter Also we cant develope Modules for Sender SOAP adapter for that we have to look for AXIS SOAP adapter).

Here is module code that you can use for Module development.

public ModuleData process(ModuleContext moduleContext, ModuleData inputData)

throws ModuleException{

String str = "";

Message mes = null;

//Fetch the Message Data from Module Data

mes = (Message) inputData.getPrincipalData();

XMLPayload xmlpayload = mes.getDocument();

String xmlText = xmlpayload.getText();

String temp = "";

// For Audit Log Fetch the Audit Message key from the message.

amk = new AuditMessageKey(mes.getMessageId(), AuditDirection.OUTBOUND);

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Excel to XML Module called");

try {

Iterator itr = mes.getAttachmentIterator();

//to iterate through all the attached messages.

Payload pay = null;

int i = xmlText.indexOf("<Content>");

while(itr.hasNext()){

pay = (Payload) itr.next();

Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS, "Payload Description: " + pay.getContentType());

if(pay.getContentType().indexOf("Excel-sheet") > 0)

//only to process excel type attachment

{

temp = temp + convert(pay.getContent()) ; //call the function that will convert the Excel data into xml formate

pay.setContent(new byte[0]); //set the attachment to zero because they are not required any more this will reduce system load

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "Excel to XML Module DATA"+ temp);

}

}

String payText = "";

payText = xmlText.substring(0, i + 9)+ temp +xmlText.substring(xmlText.indexOf("</Content>"));

xmlpayload.setText(payText);

mes.setDocument(xmlpayload);

inputData.setPrincipalData(mes);

} catch (RuntimeException e) {

e.printStackTrace();

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "error caught " + e.getMessage());

}

catch (Exception e1) {

e1.printStackTrace();

}

return inputData;

}

I had written this code to convert the Excel Attachment(there could me many attachments) in the Mail to the XML .

Thanks

Sunil Singh

Answers (1)

Answers (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>I used PayloadSwapBean Module at SOAP receiver side but still I am getting response as Attachment

this will not work in standard but you can try with SOAP axis

to receive soap with attachment and then use this standard module

Regards,

Michal Krawczyk

Former Member
0 Kudos

Thanks Michal for urs Quich response..

Would u please elaborate it more..

As i m not as expert as u in XI.

Thanks

Jaideep Jain

MichalKrawczyk
Active Contributor
0 Kudos

hi,

instead of using standard SOAP adapter use axis soap adapter

http://help.sap.com/saphelp_nwpi71/helpdata/en/45/a3c48c87cd0039e10000000a11466f/content.htm

then you should be able to use the standard swappayload module

if you put it in the correct sequense as shown here:

http://help.sap.com/saphelp_nwpi71/helpdata/en/45/a4a36de28552f7e10000000a1553f7/content.htm

then you should have the attachment from the response

as the payload

at least in theory but since there is no other way to do it

you need to go with this way:)

Regards,

Michal Krawczyk

Former Member
0 Kudos

hi Michal,

Thanks for urs valuable response.

Sorry for disturbing u again. I tried according to urs guidelines but It is not meeting my requirments..

My requirment is:--

Web site sends the data in form of file.

Website has some authentication credentials.

Input parameter for website are:-

User Name:---

Pwd:-------

File name:-----

File name will be the name of file which is having input data of which details I am to retrive from website and file type should me .xml.

When we put user name , pwd and file name, Based on file content, website will send details in the form of file. which again I am to place at FTP location.

I m facing problem at Synchronous receiver side(i.e. website) where I am using SOAP adapter.

Even Though I m getting error message from Website but I m getting that as attachment, I am unable to map it with FTP.

Can u please help me out as it is critical situation for me.

Is there any other approch to meet my requirment rather than using SOAP.

Thanks

Jaideep Jain