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