cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Adapter Module from XI 3.0 to PI 7.11

Former Member
0 Kudos

Hi All,

I'm in the process of converting an adapter module originally written for XI 3.0 to an PI 7.11 module.

I am unable to find replacements for some parts of the code. Do you know what are the PI 7.11 equivalent statements for the below code:

XI 3.0 Code:

import com.sap.aii.adapter.xi.ms.XIMessage;
import com.sap.aii.messaging.mo.Message;
import com.sap.aii.messaging.mo.xmb.XMBMessageOperator;

XIMessage aXIMessage = (XIMessage) inputModuleData.getPrincipalData();
Message xmbMessage = (Message) aXIMessage.getXMBMessage();

XMBMessageOperator.setSystemAckRequested(xmbMessage, true);
XMBMessageOperator.setSystemErrorAckRequested(xmbMessage, true);

Appreciate all your help/thoughts on the issue.

Regards,

Sumant.

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

The package com.sap.aii.messaging.mo is in internal SAP package and should not be used by customers.

In PI 7.11 there is an equivalent package com.sap.aii.af.sdk.xi.mo

This blog might be useful to find the right libraries for compiling:

Former Member
0 Kudos

Hi,

just to use the already existing thread. I currently also migrate some XI 3.0 modules to PI 7.1. Most of the imports got replaced by new libraries but one is still open:

import com.sap.aii.adapter.xi.ms.XIMessage;

I checked the blog already but the import is commented out. I also tried to change to a different kind of message but that doesn't worked as some methods are not supported.

The coding looks like this:

MessageContext inmc;

Object inpdata;

XIMessage inpmsg;

com.sap.aii.af.sdk.xi.mo.Message inmo;

XMBMessage inmsg;

inpdata = _moduleData.getPrincipalData();

if(inpdata instanceof XIMessage) {

this.fireAuditLogging("XIMessage");

inpmsg = (XIMessage)inpdata;

this.fireAuditLogging("AckDestination" + inpmsg.getAckDestination());

this.fireAuditLogging("ClassName" + inpmsg.getXMBMessage().getClass().getName());

this.fireAuditLogging("Class" + inpmsg.getXMBMessage().getClass());

this.fireAuditLogging("Class" + inpmsg.getXMBMessage().getClass());

inmc = new MessageContext();

} else if(inpdata instanceof MessageContext) {

this.fireAuditLogging("MessageContext");

inmc = (MessageContext)inpdata;

inmo = inmc.getMessage();

} else{

throw new ModuleException("object of invalid type passed in ModuleData: " + inpdata.getClass().getName());

}

this.fireAuditLogging("extract dynamic configuration");

this.extractDynamicConfiguration(inmc);

It seems to me that this coding block checks the message type and posts some information to the audit log. Somehow most of the objects are defined locally and never used again. Do i still need to check for type 'XIMessage' or is it deprecated in Pi 7.1?

Edited by: Christian Hanusch on Aug 5, 2011 4:34 PM

stefan_grube
Active Contributor
0 Kudos

In my opinion the whole code block is made only for testing and debuggung purpose and can be reduced to just one line .

import com.sap.engine.interfaces.messaging.api.Message;

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

Former Member
0 Kudos

Here is the full code of the method:

	public ModuleData process(
		ModuleContext moduleContext,
		ModuleData inputModuleData)
		throws ModuleException {

		XIMessage aXIMessage = (XIMessage) inputModuleData.getPrincipalData();
		Message xmbMessage = (Message) aXIMessage.getXMBMessage();

		AuditMessageKey amk =
			new AuditMessageKey(
				aXIMessage.getMessageId(),
				AuditDirection.INBOUND);
		Audit.addAuditLogEntry(
			amk,
			AuditLogStatus.SUCCESS,
			"FileSetAckBean: Module called");

		XMBMessageOperator.setSystemAckRequested(xmbMessage, true);
		XMBMessageOperator.setSystemErrorAckRequested(xmbMessage, true);
		inputModuleData.setPrincipalData(aXIMessage);

		return inputModuleData;
	}

maciej_jarecki
Contributor
0 Kudos

Hi

when i try to cast

XIMessage aXIMessage = (XIMessage) imd.getPrincipalData();

com.sap.aii.messaging.mo.Message xmb_m = (com.sap.aii.messaging.mo.Message) aXIMessage.getXMBMessage();

i receive class cast exception.

What is wrong ?

Does it work for both inbound and outbound scenerios ?

Br

Maciej