cancel
Showing results for 
Search instead for 
Did you mean: 

RosettaNet Attachments

Former Member
0 Kudos

Hi,

I've searched the forum, and googled, but I can find nothing on adding attachments to an RNIF 2.0 message. Would anyone have any ideas?

The message is currently being placed in the Service Content, but the server it is being posted to requires it in an attachment.

All the best,

John

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

HI,

Check the links:

Regards,

Soumya

stefan_grube
Active Contributor
0 Kudos

Are you sending or receiving the message?

What is generating the message? Idoc, proxy?

Where should the attachment come from?

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

Currently I'm sending the message, but later on the system will have to do both.

The message is being picked up by an FTP communication channel in order to send it out over RosettaNet. The RosettaNet communication is working, but the receiving server is throwing it out because there are no attachments.

Kind regards,

John

bhavesh_kantilal
Active Contributor
0 Kudos

We had a similar requirement recently, where we received a single message from a file adapter and we had to split this into a RNIF message with a attachment. After evaluating multiple options we realised that the only option was to write a module that would create this attachment message.

Never got around to implmenting this as the consuming application of our RNIF application agreed to change their process to allow us to post multiple RNIF messages.

This is definitely one area that maybe someone needs to blog on.

Stefan ~ do you have any other ideas? Would creating a attachment in a module do the trick or does RNIF attachments need some special handling?

Thanks,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Thanks for your reply. Unfortunately I suspected that it might require the writing of an adapter module to take the message out of the Service Content and into an attachment, but that makes further implementation of the communication difficult. Digitally signing the message after manipulating it in a bespoke adaptor module is not going to be easy.

I would have thought that given attachments are a basic part of the RosettaNet protocol it would be possible to add them in an implementation of that protocol.

Is it possible to manipulate the message via MIME adaptors after the RNIFModuleListener?

John

Former Member
0 Kudos

Hi Bhavesh,

I've gone down the adaptor route and written a short routine to move the contents of ServiceContent to an Attachment.

Unfortunately when I attempt to use the adaptor module after the RNIFModuleListener I get an error which can be seen in the message display as:

2008-06-11 15:20:15 Success Using agreement XI party P_MOIP, XI service PIP0C1_R0102_Responder, interface name PIP0C1_R0102_AsynchronousTestNotification, interface namespace http://sap.com/xi/RosettaNet/PIP0C1_R0102

2008-06-11 15:20:15 Success Using receiver channel Receive_PIP0C1_R0102

2008-06-11 15:20:15 Error Exception caught by adapter framework: Exception thrown in method process. The transaction is marked for rollback.

2008-06-11 15:20:16 Error Delivery of the message to the application using connection RNIF_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Exception thrown in method process. The transaction is marked for rollback.: com.sap.engine.services.ejb.exceptions.BaseTransactionRolledbackLocalException: Exception thrown in method process. The transaction is marked for rollback..

I get a similar message if I put a dummy module after the RNIFModuleListener.

When you were looking at writing an adaptor module to handle the attachments how did you aproach it? I would have thought manipulating the message before it goes through the RNIFModuleListener is not really feasible.

Kind regards,

John

bhavesh_kantilal
Active Contributor
0 Kudos

>

> Unfortunately when I attempt to use the adaptor module after the RNIFModuleListener I get an error which can be >seen in the message display as:

This I think is the issue. You might need to call your module before the RNIFModule Listener.

My reason for reaosoning it that way,

Assume a scenario where SAP triggere payload and attachment using ABAP Proxies and this has to go to the target using the RNIF adater ( Assume that SAP triggers the attachment data in the form of a PIP itself ).

In this case the adapter would auctomatically understand that the attachments need to be transmitted to the target as they do support attachments.

Similary in your case I guess the module needs to be called before the RNIFModuleListener which basically if I am right creates the RNIF message ( the Header etc ) that is transmitted using the RNIF adapter.

The custom module creates the XI message ( payload and attachment ) and this is passed to the RNIFModuleListener which does its magic and creates the RNIF message,.

let me know if this works. Thanks!

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Well, I had to read that a couple of times, first thing in the morning and all that, but I finally noticed you were referring to the XI message and not the XML message.

I think you may be on to something there. Great to know someone else has looked at the same problem.

I'll try it and get back to you with the results.

Kind regards,

John

Former Member
0 Kudos

Hi Bhavesh,

Your suggestion is producing an attachment on the RosettaNet message. I wrote a module (the core process method of which I've put below) which strips takes the message from the content of the XI message, replaces it with some dummy text, and adds the original contents as an attachment.

We're still having problems with the communication, but I believe the problem with how to add an attachment to a RosettaNet message is solved.

Many thanks for your help. It was very much appreciated.

John Lambert.

public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)

throws ModuleException

{

// get the XI message

Message msg = (Message)inputModuleData.getPrincipalData();

String SIGNATURE = "process(ModuleContext moduleContext, ModuleData inputModuleData)";

// audit

AuditMessageKey amk = new AuditMessageKey(msg.getMessageId(), AuditDirection.INBOUND);

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: Module called");

// parse the xml and generate updated xml

try

{

/*

  • retrieve the ReqAttData

*/

XMLPayload xmlPayload = msg.getDocument();

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: XML Payload retrieved");

String xmlString = xmlPayload.getText();

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: XML Text retrieved - Length " + Integer.toString(xmlString.length()));

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: XML Text retrieved\n" + xmlString);

/*

  • Retrieve information from the

*/

String sNewServiceContent="<?xml version=\"1.0\" encoding=\"UTF-8\"?><MarketMessageSC xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><FreeFormText>This is a filler service content for the Rosettanet message.</FreeFormText></MarketMessageSC>";

xmlPayload.setText(sNewServiceContent);

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: Changed Payload Text");

XMLPayload iAttachment = msg.createXMLPayload();

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: Created Attachment");

iAttachment.setContentType("text/xml");

iAttachment.setName("ReqAttData");

iAttachment.setText(xmlString);

msg.addAttachment(iAttachment);

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: Added Attachment");

}

catch(Exception e){

TRACE.errorT(SIGNATURE, "CreateAttachmentBean:process:Caught Exception setting Principal Data:"+e.getMessage());

Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, "CreateAttachmentBean: Module. Caught Exception setting Principal Data:"+e.getMessage());

ModuleException me = new ModuleException(e);

throw me;

}

TRACE.infoT(SIGNATURE, "CreateAttachmentBean:process: Completed processing");

// audit success

Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateAttachmentBean: Module completed successfully");

return inputModuleData;

}

Former Member
0 Kudos

Hi,

Please go through these links

/message/5333733#5333733 [original link is broken]

Thanks

Vikranth