on 08-07-2006 9:45 PM
Module Adapter
I have been reading "How to Create Modules for the J2EE Adapter Engine" and am trying to implement an adapter module to change a few strings in the message.
I understand I can grab the XI message using the getPrincipalData such as:
// get the XI message from the environment
Message msg = (Message) inputModuleData.getPrincipalData();
and return the message using:
// provide the XI message for returning
inputModuleData.setPrincipalData(msg);
What is the proper method of searching for strings inside this message and changing a value. We have tried the approach of using XSLT and Java maps to change values but the items we need to change need to occur at the adapter level. Any sample code around changing payload information in an adapter module would be appreciated.
Regards
Thanks for all the info.
Does anyone have example code of using SAX in an adapter module? In addition is it possible to test the adapter module before publishing with SDM?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The methods which you use with SAX parser are:
1) Start of the document(startDocument)
2) start of the element(startElement)
3) end of the element(endElement)
4) end of the document(endDocument)
5) chars()
Build your logic using these. These blogs should help you in the process:
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
You could write the java code in the process method of your bean or you could call the class from the process method.
What exactly do you mead by testng the adapter module? You could test your the java code i.e the SAX parser as you would test any standalone java code. You would be using the same in your bean.
Regards,
Chandra
Hi,
I just published a blog titled <a href="/people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs">Using JAXP to both parse and emit XML in XI Java mapping programs</a>, detailing the use of JAXP in mapping programs. The techniques are fully applicable to adapter modules as well.
Regards,
Thorsten
Hi,
If your Source to the Adapter Module is an XML , then you can use the following piece of code to change the same into an InputStream.
If you want to manipulate on the Source XML, then you can Parse this input stream using DOM / SAX to do whatever validation you want.
obj = imd.getPrincipalData();
msg = (Message) obj;
XMLPayload xp = msg.getDocument();
InputStream in=xp.getInputStream(),
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,
Please take this eg. good description of adapter module:
Regards
Vijaya
Message was edited by: vijaya kumari
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.