Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Message Transformation Bean - Usage of external classes

Hi SDNers,

I am planning to write an external Java class to be loaded from AF_Modules/MessageTransformBean . The idea is simple, I want my class to handle an extra level of hierarchy in FCC process. I know writing the Java class which is as generic as the one provided by SAP is too complex. But I just want it for some specific requirements, so I dont intend to make it as a generic class.

Should the external class that I write implement the interface Transform? If so, what is the jar file that contains this interface and where can I find this jar file in my XI installation?

Also, what is the jar file that contains the standard class that gets loaded by default while using the MessageTransformBean?

If you have already tried with similar requirements, please share your experience on the same.



Former Member

You can use the same module in J2SE and J2EE adapter without change.

I recommend to install a J2SE adapter engine on a local PC for testing.

I have found a sample code from previous tests:

package sample;


public class MyModule extends Transform {

Parameter parameter;

String filename;

	public void init(TransformConfig config) throws TransformException{
			parameter = (Parameter) config.getParameters("Parameter");

			filename = (String) parameter.get("filename");
	// obligatory method service
	public void service(TransformRequest request, TransformResponse response) throws TransformException {
		// Get the input stream for request message
		InputStream in = (InputStream) request.getMessage();
		// Get output stream for response message
		OutputStream out = (OutputStream) response.getMessage(Transform.MT_OutputStream);
		} catch (Exception e) {
			throw new TransformException("TransformException: Error converting Message " + e.getMessage(), e);
	public void execute(InputStream in, OutputStream out) throws Exception{
		String filename = (String) transformConfig.getParameters("FileName");
		if (filename == null){
			filename = "notfound.txt";
		// open file stream
		OutputStream fileOut = new FileOutputStream(new File(filename));
		// copy input stream to output stream and to file
		int c;
		while ((c = != -1) {


//	main Methode, for local testing. A local XML file is expected.
	 public static void main (String[] args) {

		 try {
			 // Define Input stream and output stream from file
			 InputStream in = new FileInputStream(new File("source.xml"));
			 OutputStream out = new FileOutputStream(new File("target.xml"));
			 // call Mapping
			 MyModule map = new MyModule();
		 } catch (Throwable t) {


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question