on 05-10-2007 10:02 AM
Hi
I have written one adapter module. IF i give that Adapter Module in Sender Communication channel its not working. If i give that in Reciever Communication Channel its working. If i mention in both the channels then its working in sender communication channel also.But in only sender communication channel its not working in only reciever communication channel its working Can any one tell me why its happening
Thanks & Regards
Ravi Shankar B
Message was edited by:
RaviShankar B
Message was edited by:
RaviShankar B
Message was edited by:
RaviShankar B
Bhavesh,
Wonderful! ..
I failed to spot that..:(
He did mention that
<i>"If i give that in Reciever Communication Channel its working."</i>
Ravi should be a much relieved person now.
Regards
krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
Check out for the direction and the rest of configuration
see the below link
https://websmp108.sap-ag.de/~sapdownload/011000358700003237612005E/HowToCreateAdapterModules.pdf
or
Regards
Chilla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There must be some propblem in the logic of the code in the Module?
Did you check fior the direction of the message in the module and write the code in it?
Regards
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
if its problem with my code why its working if i give the adapter module in both the communication channels?If i give in only sender communication channel the module is not invoking. its not showing any auditlogs.Can any one please help me
OUTBOUND is for sender
INBOUND is for reciever right.?
the following code i have written
public ModuleData process(
ModuleContext moduleContext,
ModuleData inputModuleData)
throws ModuleException {
String SIGNATURE =
"process(ModuleContext moduleContext, ModuleData inputModuleData)";
Object obj = null;
Message msg = null;
String filename = null;
AuditMessageKey amk = null;
try {
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
System.out.println("&&&&&&&&&&&&&&&&&" + msg);
if (msg.getMessageDirection().equals(MessageDirection.OUTBOUND)){
amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.OUTBOUND);
Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> etHostName: Module called"+ i++);
}else{
File filename1 = new File("
10.7.1.43
XI
source","text.txt");
filename1.createNewFile();
amk = new AuditMessageKey(msg.getMessageId(),AuditDirection.INBOUND);
Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> etHostName: Module called"+ i++);
}
System.out.println("**************" + amk + "***********");
} catch (Exception e) {
Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,">>>>>>>>>>>>>>> GetHostName: Error Module called");
e.printStackTrace(System.err);
ModuleException me = new ModuleException(e);
throw me;
}
// Read the channel ID, channel and the module configuration
try {
Hashtable mp = (Hashtable)inputModuleData.getSupplementalData("module.parameters");
if(mp != null){
filename = (String)mp.get("FileName");
Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"Host >>> Element Name is set to {0}"+filename );
}else{
Audit.addAuditLogEntry(amk,AuditLogStatus.WARNING,"HostElementName parameter is not set. Default used: HostName.");
filename = "FileName";
}
} catch (Exception e) {
e.printStackTrace(System.err);
Audit.addAuditLogEntry(amk,AuditLogStatus.ERROR,"Cannot read the module context and configuration data");
ModuleException me = new ModuleException(e);
throw me;
}
try {
XMLPayload xmlpayload = msg.getDocument();
DocumentBuilderFactory factory;
factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document =
builder.parse((InputStream) xmlpayload.getInputStream());
Element rootNode = document.getDocumentElement();
if (rootNode != null) {
Element childElement = document.createElement("filename");
childElement.appendChild(document.createTextNode(filename));
rootNode.appendChild(childElement);
}
// Transforming the DOM object to Stream object.
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer();
Source src = new DOMSource(document);
ByteArrayOutputStream myBytes = new ByteArrayOutputStream();
Result dest = new StreamResult(myBytes);
transformer.transform(src, dest);
byte[] docContent = myBytes.toByteArray();
if (docContent != null) {
xmlpayload.setContent(docContent);
inputModuleData.setPrincipalData(msg);
}
} catch (Exception e) {
e.printStackTrace(System.err);
Audit.addAuditLogEntry(amk,AuditLogStatus.ERROR,"Cannot read the module context and configuration data");
ModuleException me = new ModuleException(e);
throw me;
}
return inputModuleData;
}
Best Regards
Ravi Shankar B
Message was edited by:
RaviShankar B
Message was edited by:
RaviShankar B
Finally...!!
<b>if (msg.getMessageDirection().equals(MessageDirection.OUTBOUND)){</b>
In this if clause here you are chcking if the direction of the message is Outbound, i.e , it is outbound fromt he integartion engine to the afdapter engine. That is why the module works with receievr Adapters and not Sender Adapters.
Please remove this If clause from your code and it will work with sender adapters also.
Eactly what i asked you to check earlier.
Regards
Bhavesh
Hay Ravi,
can you give some more details? what the adapter module does? where did you added it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.