cancel
Showing results for 
Search instead for 
Did you mean: 

Adapter PI7.1 Module Problem

Former Member
0 Kudos

hi,

i'm facing a weird problem , i'll explain:

I developed a module adapter to be able get the dynamic file name into a zip file because i'm using the AF_Modules/PayloadZipBean and as we know the name of the file inside the zip in a standar way is static.

The things is that i could do the task using the following code :

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

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

Location location = null;

AuditAccess audit = null;

String unidadE,centro,unidadO =null;

// Create the location always new to avoid serialization/transient of location

try {

location = Location.getLocation(this.getClass().getName());

}catch (Exception t) {

t.printStackTrace();

ModuleException me = new ModuleException("Unable to create trace location", t);

throw me;

}

Object obj = null;

Message msg = null;

MessageKey key = null;

try {

obj = inputModuleData.getPrincipalData();

msg = (Message) obj;

key = new MessageKey(msg.getMessageId(), msg.getMessageDirection());

audit = PublicAPIAccessFactory.getPublicAPIAccess().getAuditAccess();

audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS, "BuildFileName: Module called");

}

catch (Exception e) {

ModuleException me = new ModuleException(e);

throw me;

}

try {

TextPayload xmlpayload = msg.getDocument();

DocumentBuilderFactory factory;

factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse((InputStream)xmlpayload.getInputStream());

NodeList nodosTablaProcesa = document.getElementsByTagName("TablaProcesa");

Element elementFPVM00 = (Element) nodosTablaProcesa.item(0);

NodeList nodoFPVM00 =elementFPVM00.getElementsByTagName("FPVM00");

Element elementRegistro =(Element) nodoFPVM00.item(0);

NodeList nodoRegistro = elementRegistro.getElementsByTagName("reg");

Element element = (Element)nodoRegistro.item(0);

NodeList valorNumcia = element.getElementsByTagName("NUMCIA");

Element valNumcia =(Element) valorNumcia.item(0);

NodeList valorNumAlm = element.getElementsByTagName("NUMALM");

Element valNumalm = (Element)valorNumAlm.item(0);

NodeList valorSubAlm = element.getElementsByTagName("SUBALM");

Element valSubalm = (Element) valorSubAlm.item(0);

unidadE =getCharacterDataFromElement(valNumcia);

centro = (getCharacterDataFromElement(valNumalm)).replace("'","");

unidadO =(getCharacterDataFromElement(valSubalm)).replace("'","");

String fileName = "RT"unidadEcentrounidadO".xml";

audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS, "BuildFileName:" +fileName);

if(fileName == null)

xmlpayload.setContentType("text/plain;charset = "UTF-8";filename="defaultbeanfile.txt"");

else

xmlpayload.setContentType("text/plain;charset = "UTF-8";filename="" + fileName + """);

audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS, "BuildFileName:" +xmlpayload.getContentType());

inputModuleData.setPrincipalData(msg);

} catch (Exception e) {

ModuleException me = new ModuleException(e);

audit.addAuditLogEntry(key, AuditLogStatus.ERROR, "BuildFileName: Module Fail");

throw me;

}

return inputModuleData;

}

the problem is when we transport this module to QA environment isn´t working , instead of put the dynamic file name is putting "untitled.txt" , in DEV everything is fine , do you know about some bugs in PI 7.1 ?? some notes that could help?

thanks in advanced

my config in the file adapter is the following

PROCESSING SEQUENCE

BuildFileName Local Enterprise Bean contentType

AF_Modules/PayloadZipBean Local Enterprise Bean zip

CallSapAdapter Local Enterprise Bean 2

MODULE CONFIGURATION

zip zip.filenameKey contentType

zip zip.mode zipOne

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

the problem is when we transport this module to QA environment isn´t working , instead of put the dynamic file name is putting "untitled.txt" , in DEV everything is fine , do you know about some bugs in PI 7.1 ?? some notes that could help?

When it is working in dev, but not in qa, could you check that SP and SPS version of the systems are equal?

Make also sure, that your module is deployed in both system in the same version.

The code seems correct on sight. Is the audit log entry with the file name available? Is this correct?

Regards

Stefan

Former Member
0 Kudos

Hi Stefan ,

for example in QA we have some diferences ,

QA SAP_XIAF -> 1000.7.10.6.18.20090211173100

DEV SAP_XIAF-> 1000.7.10.6.13.20081124173200

It seems like QA has an updated , but in QA is not working, do you know what packages could be causing this problem? at first sight i choose SAP_XIAF because the adapter framework ,

The code seems correct on sight. Is the audit log entry with the file name available? Is this correct?

Yes , when i saw the audit log in MessagingSystem monitor , i can see the well file name formed (ex "RT213AC00AC0000.xml") ,

thanks

stefan_grube
Active Contributor
0 Kudos

What happens when you provide the content type with MessageTransformBean like in this blog:

/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework

Does this behave the same?

Regards

Stefan

Former Member
0 Kudos

hi Stefan,

I tested this case , when i use the MessageTransformBean it works , it put in static way the file name, the "untitled.txt" was replaced by the name that i put into Transform.ContentType,

Regards

stefan_grube
Active Contributor
0 Kudos

I think you should redeploy your adapter module. It might be different from the latest version.

Regards

Stefan

Former Member
0 Kudos

Thank´s Stefan , I´ll redeploy ,

regards

Answers (0)