Effective error handling in Adapter Module
eX(i)perts..
Can anybody share the effective error handling strategies inside adapter modules?
Specifically looking for
1. Module parameters configuration related error handling
2. Business logic failure owing to incorrect data.
-- Amol
Hi,
Please see the following PDF documents to develop the Module processor programs.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81
http://help.sap.com/saphelp_nw04/helpdata/en/0d/00453c91f37151e10000000a11402f/frameset.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e21106cc-0c01-0010-db95-dbfc0ffd83b3
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9913a954-0d01-0010-8391-8a3076440b6e
help : http://ifr.sap.com
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6f83d790-0201-0010-629d-ab5bf10c94e4
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f02d12a7-0201-0010-5780-8bfc7d12f891
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7bf6e190-0201-0010-83b7-cc557eb76abe
Some weblogs for JAVA mapping for IDoc mapping
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
Difference in using java,xslt,message mapping
Regards
Chilla..
Similar Messages
-
Is it possible to send error message from Adapter Module to CCMS?
Hi
Is it possible to send error message from Adapter Module to CCMS...?I have written on adatper module from there i have to send error message to CCMS or SXMB_MONI. Is it possible if yes please send me the related documents
Best Regards
Ravi Shankar BHi
I have written following User Defined Exeption in my Module program
class DuplicateFileException extends ModuleException{
DuplicateFileException(String message){
super(message);
I am throwing my Exception like this
try{
throw new DuplicateFileException("Duplicate File");
}catch(DuplicateFileException e){
throw e;
But i am not getting this exception in SXMB_MONI. In adpater monitoring i am getting the following exceptions
<b>
2007-05-16 15:51:30 GMT+05:30: Retry interval started. Length: 5.000 s
- 2007-05-16 15:51:30 GMT+05:30: Error: java.lang.NullPointerException
- 2007-05-16 15:51:30 GMT+05:30: An unknown error occured.
- 2007-05-16 15:51:30 GMT+05:30: Processing started
- 2007-05-16 15:51:25 GMT+05:30: Error: java.lang.NullPointerException</b>
can any one give me the idea how to send error from module program to SXMB_MONI
Thanks & Regards
Ravi Shankar B -
Error in File adapter Module.-- the whole lookup name is localejbs/localjbs
Hi All,
Iam just trying to do File to IDoc scenario using Seeburger Modules.File is picked and when it enters into modules , it is showing the below error.
Success Channel CC_SND: Send binary file "/sapint/testout/Input_Test". Size 2568 with QoS EO
Error Attempt to process file failed with com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at localjbs, the whole lookup name is localejbs/localjbs/SeeClassifier.
The Steps which i followed in Module are as follows.
ModuleName ModuleKey
localjbs/SeeClassifier classifier
localejbs/CallBicXIRaBean bic
localejbs/Seeburger/MessageSplitter splitter
ModuleKey ParamterName ParameterValue
bic mappingName AUTO
bic destSourceMsg MainDocument
bic destTargetMsg MainDocument
bic split true
bic classifierAttID classifierAtt
classifier destSourceMsg MainDocument
classifier attID classifierAtt
classifier showInAuditLog true
If anyone has idea what might be wrong?? kinldy share the same.
Its urgent for me.
ThankYou
Seema.Hi,
I think you have done a typo error. is it not
localejbs/SeeClassifier classifier*
To find the correct JNDI lookup name, log in to Visual Administrator of the J2EE Engine and in server node look for the JNDI Registry Service.Spot your desired bean and fetch the whole JNDI name form there.
Regards,
Sudharshan N A -
Duplicate File Handling using Adapter Module
Hi All
The Scenario is like this------
XI is picking a files from FTP location.
Duplicate files are also getting picked by XI.
To handle this i have written a module which is finding it out wheather the file is duplicate or not. If the file is not duplicate then it is getting processed.
Now the problem i am facing is -
I dont want to process the file if it is found duplicate, then what code i should write.
What are the ways i can stop the processing of duplicate file.
Regards
Dheeraj KumarHi
I have implemented a module in which i can find out wheather the file is duplicate or not. If the file is not duplicate process the file.
now the problem is --- if file is duplicate then i dont want to process the file.
How can i achieve this?
Regards
Dheeraj Kumar
Edited by: Dheeraj Kumar on Nov 30, 2009 3:21 PM -
Adapter Module Error in PI 7.1
Hi,
I have built an adapter module which has been successfully deployed on PI 7.1 using JSPM, but in communication channel monitoring it is giving below error.
Error: com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Object not found in lookup of UserModuleTestEjb
In Module tab of communication channel I have passed Bean name, which works fine for other Adapter Module but strangely its not working for this one.
I have also passed JNDI name which is same as EJB bean name. I have tried several other combinations like below none is working.
localeejbs/UserModuleTestEjb
localeejbs/sap.com/UserModuleTestEjb
Regards,
Nishanthi,
Check if u have added correct references in application-j2ee-engine.xml file and if u are using external library it is there in SDA file.
/people/stefan.grube/blog/2008/12/11/adjust-your-pi-70-adapter-modules-for-pi-71-in-15-minutes
Thanks. -
Error Handling in File Adapter
I have been working on a requirement where the file adapter picks up the file and gives to the BPEL for processing the data.
So, in order to do Error Handling for file adapter, i have been reading the Oracle documentation for technology adapters. In that, some of the
points which i felt valuable for my error handling when using file adapter are the uniqueMessageSeparator property, fault-policies for rejected messages,
and one of the action for rejected messages could be writing the payload to a file or invoking any other webservice.
In my composite, i have configured the file adapter as a service for reading files, and i defined the xsd using the native format builder....If i put some data like 'aaaa' in the attribute of type integer , the .csv file is being picked up and its being passed to the BPEL without any error ? I believe there should be a translation error...right...
But i am not getting the error, please tell me if anything is wrong in my xsd....
Here is my xsd...
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://TargetNamespace.com/InboundService"
targetNamespace="http://TargetNamespace.com/InboundService"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
nxsd:version="NXSD"
nxsd:stream="chars"
nxsd:encoding="US-ASCII"
nxsd:hasHeader="true"
nxsd:headerLines="1"
nxsd:headerLinesTerminatedBy="${eol}"
>
<xsd:element name="names">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," />
<xsd:element name="LastName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," />
<xsd:element name="Number" type="xsd:integer" nxsd:style="terminated" nxsd:terminatedBy="${eol}" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
And for DB Adapter, there is a property called SchemaValidation, i think that is not there for File adapter, by default it will take care of validation i guess....In another composite, my file adapter is picking up the .xml file and if i put any wrong data over there, that is working fine, i am getting the translation error, but only here in the case of csv file, i am not getting the error. Experts, please help me in this regard...I am using SOA 11G
Thanks,
NareshHi Yatan,
Thanks for the reply. I did the same way, where my composite is picking up an XML file and translation error is coming. Even the fault policies are working fine, like writing to a file and even invoking other web service. Its really good that you have achieved the same thing in csv files. But the same thing i am unable to achieve when my file adapter is picking up the csv file. I really cant understand where i am doing wrong.
here is my XSD which i defined through my native builder format...
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://TargetNamespace.com/FileRecv"
targetNamespace="http://TargetNamespace.com/FileRecv"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
nxsd:version="NXSD"
nxsd:stream="chars"
nxsd:encoding="US-ASCII"
nxsd:hasHeader="true"
nxsd:headerLines="1"
nxsd:headerLinesTerminatedBy="${eol}"
>
<xsd:element name="Roots">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="FirstName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""" />
<xsd:element name="LastName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy=""" />
<xsd:element name="Number" type="xsd:integer" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy=""" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
the jca file ..
<adapter-config name="FileRecv" adapter="File Adapter" wsdlLocation="FileRecv.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
<connection-factory location="eis/FileAdapter" UIincludeWildcard="n*.csv"/>
<endpoint-activation portType="Read_ptt" operation="Read">
<activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
<property name="DeleteFile" value="true"/>
<property name="MinimumAge" value="0"/>
<property name="PhysicalDirectory" value="C:\files"/>
<property name="Recursive" value="false"/>
<property name="PollingFrequency" value="5"/>
<property name="IncludeFiles" value="n.*\.csv"/>
<property name="UseHeaders" value="false"/>
</activation-spec>
</endpoint-activation>
</adapter-config>
I told that the file will contain only 1 record while defining xsd and i kept a record whose values are John , Peter and akjdkjdskj.
Now if the data is like above, the file is still getting picked up without any translation error and the BPEL is getting completed successfully...
Is it possible for you to send your sample project and the csv file from which you have defined the xsd to me if you dont mind ?
Thanks,
Naresh -
File sender adapter Module Error
Hi Everybody,
I have developed an adapter module for file sender to rename the file name which is picked from the directory and I am getting an error
"Attempt to process file failed with java.lang.NullPointerException".
Can anybody tell me why is this error?
Thanks,
ZabiHi,
first check that module has been succesfully executed or not .This you can check in RWB .
Secondly go in the file adpater and click on to module tab and check
1-there will be two things one will be adapter module that you have depolyed. other one will be call sap adapter.
2- make sure that call sap adapter should come after the module you have deployed. and having the key value less then adapter module (let say your adapter module is having the key value 1 and call sap adpater is having the key value 0 then you need to change the key value there)
Thanks
sachin -
Hi
Experts,
i have an adapter module for 7.0 and i am trying to replicate the same for PI 7.1 in 7.1 NWDS.
i have made the required changes as mentioned in stefan's blog :/people/stefan.grube/blog/2008/12/11/adjust-your-pi-70-adapter-modules-for-pi-71-in-15-minutes
but import com.sap.aii.mappingtool.tf7.rt.Container; shows error , do we need to inlcude any jar file for this :
i am using this module to rename file name (in case of pick and place scenario forwithot IR configuration)
getMessageProperty and setmessageProperty is getting deprecated.(striked off)
strFileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File","FileName");
Regards,
Srinivas> strFileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File","FileName");
in PI 7.1 you can use:
strFileName = msg.getMessageProperty(new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File"));
Note that property name and namspace come in different order. I almost got mad until I noticed
http://help.sap.com/javadocs/pi/SP3/xpi/index.html -
Adapter Module deployment error in PI 7.1
Hi Experts,
I have successfully deployed a adapter module on PI 7.1 thru NWDS, I see the ejb in NWA as well...
when i try to use it tit throws this error in comm channel monitoring
Error: javax.ejb.TransactionRolledbackLocalException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBTransactionRolledbackException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException; nested exception is: javax.ejb.EJBException: (Failed in component: sap.com/UserModule_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sap.adaptermodule.GetHostNameBean.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sap.adaptermodule.GetHostNameBean@299c92f0 for bean sap.com/UserModule_EARxml|UserModule_EJB.jarxml|GetHostName in application sap.com/UserModule_EAR.; nested exception is: java.lang.NullPointerException
any help is appreciated
Regards,
TejaHi Prateek,
Im facing the same issue...,So i thought I should add to this thread instead of posting a new one
The com channel looks as follows
Processing sequence:
Number ModuleName Type moduleKey
1 ModuleName LocalEnterpriseBean 0
2 CallSapAdapter LocalEnterpriseBean 2
Module Configuration
I have nt added anything in this module configuration tab...can u help me on this
Edited by: Ibrahim on Sep 9, 2009 12:50 PM -
Adapter Module Error-Sending excel file as an attachment of the mail
Hi ,
My scenario is as follows
1)I am sending an excel file as an attachment of the mail.I need to read that excel attachment as a payload.
So mail adapter is used in sender side.
To configure this, have used standard PayloadSwapBean module with proper module key.
Next to convert excel to XML another custom adapter module is being used.
Both this adapter module , I configured into the CC of sender mail adapter.
The order in which adapter modules are being used in the sender CC are as follows
1)localejbs/AF_Modules/PayloadSwapBean
2)localejbs/MDPExcelToXMLConversion
3)sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean
MDPExcelToXMLConversion-Custom adapter module written to convert excel to xml.
I am getting the following error
exception caught during processing mail message [4899]com.sap.aii.af.lib.mp.module.ModuleException
And also,
no messages in coming MONI of PI.
Pls suggest what to do.
Thanks
AyanShabarish,
Will the ordering in which the adapter modules(In this case there are two-PayloadSwapBean & MDPExcelToXML) are appearing into Module tab of sender adapter matter?
Firstly, what is happenning
1)If I take out the custom adapter module MDPExcelToXML and put only PayloadSwapBean then it is successfully converting mail attachment into the main Payload i.e PayloadSwapBean module is working.
2)Nextly, my local code( i.e java code without including standard Module specific method like ejbActivate(),ejbPassivate(),process() etc etc.)) for MDPExcelToXML is successfuly converting the excel file into the XML file.Then I am making the local code into adapter module specific code and deploying that.
A few question arises here,
Do I need to do any specific configurations here in PI for this particular things.Maybe both the adapter module is clashing with each other.
And also using tracing and logging into my custom adapter module code.Getting the following error,
java.io.IOException: Unable to read entire header; 116 bytes read; expected 512 bytes#
Thanks
Ayan -
Reg::Error in XMLDecryption algorithm for adapter module in SAP PI
Hi Experts,
I have developed a custom java code for encryption and decryption for XML to be included in adapter module in SAP PI using SAP netweaver.My decryption code is working fine for stand alone java application.But when I create EJB project and deploy it I get no error..But in communication monitoring of SAP PI i get the below error
Error: org.apache.xml.security.encryption.XMLEncryptionException: No Key Encryption Key loaded and cannot determine using key resolvers
I included xmlsec1.3.0.jar file as external library..
I would be grateful if you could suggest any solution for the above issue.
Thanks
PriyaHi Priya,
I am working on the same senario if Uhave idea plz help me on it.
Regards,
Prasad. -
Error in adapter module Upgrade PI7.11
Hello,
After upgrade from XI3.0 to PI7.11,I am trying to adapt code of an adapter module in order to use it in new version.
I have changed the code ,there were no compilation errors and it was deployed successfully.
But when trying to test the scenario ,I am getting following error:
<code>ADAPTER.JAVA_EXCEPTION</code>
<text>javax.ejb.EJBException: (Failed in component: sap.com/ValidationModule7.11_EAR) Exception raised from invocation of public com.sap.aii.af.lib.mp.module.ModuleData com.sapcons.xi.af.validation.ValidationModuleBean711.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException method on bean instance com.sapcons.xi.af.validation.ValidationModuleBean711@4dee79d1 for bean sap.com/ValidationModule7.11_EARxml|ValidationModule7.11_EJB.jarxml|ValidationModuleBean711 in application sap.com/ValidationModule7.11_EAR.; nested exception is: java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.MessageKey.getMessageId() of an object loaded from local variable 'msgKey'
java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.MessageKey.getMessageId() of an object loaded from local variable 'msgKey'
I am nowhere using variable 'msgkey' in my code.
I was using getMessageId() method and because of this error,I have changed the code such that I am not using this method at all.
After this change ,I have deployed the module again,and the strange part is I am still getting the same error.
Just to be sure that I have deployed the changed code,I created an altogether new module ValidationModule7.11_EAR(it was ValidationModule_EAR before) and deployed it,I am sure ,I am not using getMessageId() method at all,but I am getting the same error (as mentioned above).
I have no idea why I am getting the same error.I can see in the error message that my new module is called which doesn't use this method.
Can anyone please suggest apart from saving the Bean after code changes and redeploying the code,what needs to be done.
(Rebuilding the project,etc.)
It would be great if I can get some inputs on this strange behaviour.
Thanks a lot.
Best Regards,
ShwetaHello Stefan,
Thanks for your reply.
I have created my new module with a different JNDI name.
Also,I have verified that there is a link to the interface com.sap.aii.af.ifc.facade in application-j2ee-engine.xml .
This was the code which I was trying to adapt:
if((MessageContext)inputModuleData.getPrincipalData() instanceof MessageContext)
MessageContext messsageContext = (MessageContext)inputModuleData.getPrincipalData();
Message message = messsageContext.getMessage();
Attachment rootDocument = message.getRootDocument();
Object data = rootDocument.getData();
if(data instanceof Binary)
Binary bin = (Binary)data;
request = bin.getBytes();
String messageID = "1232";
if(dir == Direction.INBOUND)
amk = new AuditMessageKey(messageID, AuditDirection.INBOUND);
else
amk = new AuditMessageKey(messageID, AuditDirection.OUTBOUND);
But I was getting errors like MessageContext not recognized and also,for the statement:
Attachment rootDocument = message.getRootDocument();
I was getting an error in statement : if(data instanceof Binary) as following imports weren't recognized.
import com.sap.aii.messaging.lang.Binary;
import com.sap.aii.messaging.mo.*;
So I used import com.sap.aii.af.service.cpa.BinaryData; and following code
Object obj = null;
Message message = null;
obj = inputModuleData.getPrincipalData();
if(obj instanceof BinaryData)
message = (Message)obj;
BinaryData bin = (BinaryData)obj;
request = bin.getData();
String messageID = "1232";
amk = new MessageKey(messageID, message.getMessageDirection());
Code was compiled correctly and deployed ,but I get this error with getMessageId() when I try to test it.You can see I am not using getMessageId() and msgkey anywhere in the code
Thanks for your help
Regards,
Shweta -
Error in Adapter Module to unzip files
Hello ,
I wish to unzip many files with use of an adapter module
To du this I use following code
package de.lsv.moduledevelopement;
import java.io.*;
import java.util.Hashtable;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import com.sap.aii.af.mp.module.Module;
import com.sap.aii.af.mp.module.ModuleContext;
import com.sap.aii.af.mp.module.ModuleData;
import com.sap.aii.af.mp.module.ModuleException;
import com.sap.aii.af.ra.ms.api.Message;
import com.sap.aii.af.ra.ms.api.MessageDirection;
import com.sap.aii.af.ra.ms.api.Payload;
import com.sap.aii.af.ra.ms.spi.Trace;
import com.sap.aii.af.service.auditlog.Audit;
import com.sap.aii.af.service.auditlog.AuditDirection;
import com.sap.aii.af.service.auditlog.AuditLogStatus;
import com.sap.aii.af.service.auditlog.AuditMessageKey;
* @ejbLocal <{de.lsv.moduledevelopement.UnZipFilesLocal}>
* @ejbLocalHome <{de.lsv.moduledevelopement.UnZipFilesLocalHome}>
* @stateless
public class UnZipFilesBean implements SessionBean, Module {
static AuditMessageKey amk = null;
static String auditStr = "UnzipFilesBean - ";
static ModuleException mEx = null;
public static final String VERSION_ID =
"$Id://de.lsv.moduledevelopement.UnZipFilesBean.java#1 $";
private static final Trace TRACE = new Trace(VERSION_ID);
public void ejbRemove() {
public void ejbActivate() {
public void ejbPassivate() {
public void setSessionContext(SessionContext context) {
myContext = context;
private SessionContext myContext;
* Create Method.
public void ejbCreate() throws CreateException {
// TODO : Implement
/* (non-Javadoc)
* @see com.sap.aii.af.mp.module.Module#process(com.sap.aii.af.mp.module.ModuleContext, com.sap.aii.af.mp.module.ModuleData)
public ModuleData process(
ModuleContext moduleContext,
ModuleData inputModuleData)
throws ModuleException {
Object obj = null;
Message msg = null;
Payload attachment = null;
//initializing variables for module parameters
String modkey = "";
String fileMask = "";
String directory = "";
String saveDirectory = "";
// String newMimeType = "";
// String newAttachmentName = "";
// String newAttachmentExtension = "";
// String newAttachmentNameReplace = "";
//this block is to manage the adapter when is not file/FTP
try {
//get the XI Message
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
// create AuditMessageKey object to write audit log.
if (msg.getMessageDirection() == MessageDirection.INBOUND)
amk =
new AuditMessageKey(
msg.getMessageId(),
AuditDirection.INBOUND);
else
amk =
new AuditMessageKey(
msg.getMessageId(),
AuditDirection.OUTBOUND);
// ******start get the module parameters from the configuration******
modkey = moduleContext.getContextData("module.key");
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Module Configuration Key: " + modkey);
//***** einlesen der Moduke Parameter******************
//***** DateiMaske
fileMask = moduleContext.getContextData("FileMask");
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "FileMask: " + fileMask);
// check ob fileMask definiert ist
if (fileMask == null || fileMask.equalsIgnoreCase("")) {
//if no attachment name is specified in the module configuration the module will end the execution
throw mEx =
new ModuleException(
auditStr
+ "!FileMask in Modulconfiguration nicht definiert!");
//***** DateiMaske2
String fileMask2 = moduleContext.getContextData("FileMask2");
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "FileMask2: " + fileMask2);
//***** Directory
directory = moduleContext.getContextData("Directory");
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Directory: " + directory);
// Fehler wenn Directory nicht definiert
if (directory == null || directory.equalsIgnoreCase("")) {
//the module will end the execution
throw mEx =
new ModuleException(
auditStr
+ "Directory in Modulconfiguration nicht definiert");
//***** Sicherungs Verzeichnis
saveDirectory = moduleContext.getContextData("SaveDirectory");
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "SaveDirectory: " + saveDirectory);
// entpacken aufrufen
entpacke(directory, saveDirectory, fileMask);
if (fileMask2.length() > 0) {
entpacke(directory, saveDirectory, fileMask2);
//update the XI Message
inputModuleData.setPrincipalData(msg);
} catch (Exception e) {
String errorMessage =
auditStr + "Error bei der . Exception:" + e.getMessage();
Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, errorMessage);
throw mEx = new ModuleException(auditStr + errorMessage);
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Verarbeitung beendet ");
return inputModuleData;
//+++++++++++++++++++++++++
private static void entpacke(
String directory,
String saveDirectory,
String mask)
// TODO Auto-generated method stub
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Funktion entpacke");
if (!directory.endsWith("\")) {
directory = directory + "\";
} // if
File f;
f = new File(directory);
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "f = new File(directory)");
// // Achtung Klasse in einer Klasse :-)
// String[] strFiles = f.list(new FilenameFilter() {
// public boolean accept(File file, String filename) {
// Wildcard wildcard1 = new Wildcard(mask);
// Audit.addAuditLogEntry(
// amk,
// AuditLogStatus.SUCCESS,
// auditStr + "wc1");
// return wildcard1.match(filename, false);
String [] strFiles = f.list(new MyFilter(mask));
// Liste der Gefundenen dateien
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Anzahl gepackter Dateien: " + strFiles.length);
//System.out.println( strFiles.length + " Dateien zum entpacken");
for (int i = 0; i < strFiles.length; i++) {
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "verarbeite Datei: : " + strFiles<i>);
// System.out.println("f[" + i + "]=" + strFiles<i>);
} // for
// *****entpacken**********************
for (int i = 0; i < strFiles.length; i++) {
try {
byte[] buf = new byte[4096];
ZipInputStream in =
new ZipInputStream(
new FileInputStream(directory + strFiles<i>));
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Entpacke " + directory + strFiles<i>);
//System.out.println("Entpacke " + directory + strFiles<i>);
int count = 0;
while (true) {
count++;
// Nächsten Eintrag lesen
ZipEntry entry = in.getNextEntry();
if (entry == null) {
break;
// Beschreibung ausgeben
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + entry.getName());
//System.out.println(entry.getName());
// Ausgabedatei erzeugen
FileOutputStream out =
new FileOutputStream(directory + entry.getName());
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
out.close();
// Eintrag schließen
in.closeEntry();
} // while
in.close();
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + count + "Dateien entpackt");
//System.out.println(count + "Dateien entpackt");
// verschieben
if (saveDirectory.length() > 0) {
File quelle = new File(directory + strFiles<i>);
File ziel = new File(saveDirectory + strFiles<i>);
boolean bla = quelle.renameTo(ziel);
if (!bla) {
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr
+ strFiles<i>
+ " konnte nicht verschoben werden");
} else {
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr
+ strFiles<i>
+ "verschoben nach "
+ saveDirectory);
// System.out.println(
// strFiles<i> + "verscgoben nach " + directory + "sik//");
} // if
} catch (Exception e) {
String errorMessage =
auditStr
+ "Error in entpacken. Exception:"
+ e.getMessage();
Audit.addAuditLogEntry(amk, AuditLogStatus.ERROR, errorMessage);
} // catch
// *****entpacken*************
} // for
} //entpacke
} // UnzipFilesBean
class Wildcard {
static AuditMessageKey amk = null;
static String auditStr = "WildCard - ";
static ModuleException mEx = null;
private final String wildcardString;
* Der Konstruktor für die WildcardSuche.
* @param wildcardString
* Der WildcardString
public Wildcard(String wildcardString) {
this.wildcardString = wildcardString;
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Constructor");
* Die Methode, welche den Vergleich durchführt.
* @param str
* Der String, welcher darauf überprüft werden soll, ob er dem
* WildcardString entspricht.
* @return true Wenn der String dem wildcardString entspricht.
public boolean match(String str, boolean fCasesensitive) {
if (str == null || wildcardString == null) {
return false;
return recursiveMatch(wildcardString, str, fCasesensitive);
* Hier wird der eigentliche Vergleich durchgeführt
* @param strWildcard
* Der Wildcardstring, z.B.: "Test*"
* @param str
* Der zu überprüfende String, z.B. "Testlauf"
* @return true, wenn eine Übereinstimmung vorhanden ist, sonst false
private boolean recursiveMatch(
String strWildcard,
String str,
boolean fCasesensitive) {
while (true) {
if (strWildcard.length() == 0)
return str.length() == 0;
char ch = strWildcard.charAt(0);
switch (ch) {
case '?' :
if (str.length() == 0)
return false;
break;
case '*' :
strWildcard = strWildcard.substring(1);
while (true) {
if (recursiveMatch(strWildcard, str, fCasesensitive))
return true;
if (str.length() == 0)
return false;
str = str.substring(1);
default :
if (str.length() == 0)
return false;
if (fCasesensitive) {
if (ch != str.charAt(0))
return false;
} else if (
Character.toLowerCase(ch)
!= Character.toLowerCase(str.charAt(0)))
return false;
break;
strWildcard = strWildcard.substring(1);
str = str.substring(1);
//++++++++++++++++++++++++++
} // class
/** Nun der eigentliche Filter */
class MyFilter implements FilenameFilter {
static AuditMessageKey amk = null;
static String auditStr = "MyFilter - ";
static ModuleException mEx = null;
String fileMask;
public MyFilter(String fileMask) {
this.fileMask = fileMask;
Audit.addAuditLogEntry(
amk,
AuditLogStatus.SUCCESS,
auditStr + "Constructor");
} //constructor
public boolean accept(File file, String filename) {
// TODO Auto-generated method stub
//fileMask = "?5LBL*";
Wildcard wildcard1 = new Wildcard(fileMask);
return wildcard1.match(filename, false);
} //class
But in Audit Protocol it failed after:
17.09.2008 17:33:19 Erfolgreich UnzipFilesBean - Module Configuration Key: 2
17.09.2008 17:33:19 Erfolgreich UnzipFilesBean - FileMask: ?5LBL???
17.09.2008 17:33:19 Erfolgreich UnzipFilesBean - FileMask2:
17.09.2008 17:33:19 Erfolgreich UnzipFilesBean - Directory: //transfer//X1E//100//99//lb//ein
17.09.2008 17:33:19 Erfolgreich UnzipFilesBean - SaveDirectory: //transfer//X1E//100//99//lb//ein_s
17.09.2008 17:33:19 Erfolgreich UnzipFilesBean - Funktion entpacke
17.09.2008 17:33:19 Erfolgreich UnzipFilesBean - f = new File(directory)
17.09.2008 17:33:19 Fehler UnzipFilesBean - Error bei der . Exception:null
I could not find the error??
Were there any log files to look into?
regarts
ZimmerningkatHi Ralf,
I am late..........
I am bit confused with your explanation.
1. Does all zip files will be picked by file adapter in one shot or is it conditional, since you have a XML descriptor file in firts zip file and the XML files describes the list of JPEG files which might be stored in the other zipped JPEG files?
2. Can you tell the exact flow of your scenario
3. Receiver in your scenario?
Thanks,
Gujjeti. -
File adapter module enhancement error
Hello All,
We have a EDI scenario where data for 110 is to be transfered to SAP. Here customer is not able to ahead with seeburger hence decided to develope a adapter module. We have done that and started testing . While testing we are getting a error, in which ":" is field separator which is getting converted to "[]" . This we found when we debugged module process method. Pl can you suggest why this conversion is happening and how to resolve.
If you see , When I use only standared sap module file is getting read as it is. There is no such conversion happening.
Pl can you suggest at the earliest possible.
thanks,
SharadaHi,
I think you have done a typo error. is it not
localejbs/SeeClassifier classifier*
To find the correct JNDI lookup name, log in to Visual Administrator of the J2EE Engine and in server node look for the JNDI Registry Service.Spot your desired bean and fetch the whole JNDI name form there.
Regards,
Sudharshan N A -
Adapter module Transform.Class error
Hello,
I have a sender jdbc adapter which is calling the xslt transform class with no errors but its obvious that the xsl is not being invoked as my xml is not transformed, but I don't see any error in the audit log. When I purposely use a non existent file path/file name in XSLTConversion.XSLTFileName I expect to get an error in the message monitor audit log but I do not. Neither default.trace or xi.*.log provide any errors regarding the xslt transformation in the adapter module. The audit log actually indicates: "Transform: successfully transformed" Below is my adapter module configuration. Can anyone point me to a log file that might contain adapter module errors or notice any problem with this module config?
localejbs/AF_Modules/MessageTransformBean, Local, XSLT
CallSapAdapter, Local, call_AF_MS
XSLT, Transform.class, com.sap.aii.messaging.adapter.XSLTConversion
XSLT, XSLTConversion.XSLTFileName, /usr/sap/XIS/DVEBMGS00/j2ee/cluster/server0/tmgxsls/GL_split.xsl
Thanks in advance,
DaveHi
Check for correct spelling:
localejbs/AF_modules/MessageTransformBean
Check the parameters for trailing spaces:
'com.sap.aii.messaging.adapter.XSLTConversion_'
Check the path:
Windows: C:\...
Unix: /usr/...
and
Check the adit log of the message monitoring in the RWB for entries according to the module....
Trc or trace files on visual administrator is the closest answer from my part.
please refer,
/people/michal.krawczyk2/blog/2005/09/07/xi-why-dont-start-searching-for-all-errors-from-one-place
regards,
vasanth
Maybe you are looking for
-
When I open my iChat, the offline buddies appear but will not display as online. I know that people are online and using their chat, but I cannot seem to get Chat to display available contacts. Have I done something wrong?
-
Address book sync that doesn't sync all
After having read a lot of post and message about possible cause on partial sync on address book contact, in particular this topic (http://discussions.apple.com/thread.jspa?messageID=6696772&) I leave the recipe that has worked for me. In my case I h
-
Hi All, I need to change the currency format in App's GL FSG report. It's by default comes 999,999,999,999,99.999 form this i need to change into Indian currency format (99,99,99,99,999.99). I tried to changed the format in column set but it doesn't
-
Can we have two different web url for a same instance ??
Can we have two different web url for a same instance ?? I have read it somewhere that it's possible in R12....please correct me if I am wrong...and if it's correct please let me know the doc id for it...
-
hi there i sthere anyway else then query designer that i can create my variable.i guess there must be some way else. please advise