Skip to Content

In my earlier blog “[XSLT: Runtime Value Mapping from Integration Directory using XIVMService.class |]” , I tried to explain concept to call value mapping at runtime from Integration Directory using XSLT Mapping. Same procedure can be applied to Java Mapping also to access ValueMapping at run time.

I will make use of same data type, message type and interface mapping created earlier. Here is our data type.


Java Code to call value mapping at runtime;

<p align=”left”>import;</p>


import java.util.Map;

*<p align=”left”>import javax.xml.parsers.;</p>*<p align=”left”>import org.xml.sax.;</p>*<p align=”left”>import org.xml.sax.helpers.;</p>*import;


public class ValMapping extends DefaultHandler implements StreamTransformation{ </p>*<p align=”left”>private Map map;private* OutputStream out;


private boolean a1 = false;


private boolean b1 = false;


private boolean c1 = false;


private int a;


private int b;</p>*private int c;

String lineEnd = System.getProperty(“line.separator”);


public void setParameter (Map param) {

map = param;


public void execute (InputStream in, OutputStream out)throws {

DefaultHandler handler = this;

SAXParserFactory factory = SAXParserFactory.newInstance();</p>try {

SAXParser saxParser = factory.newSAXParser();

this.out = out;

saxParser.parse(in, handler);


catch (Throwable t){



<p align=”left”>private <strong>void write (String s) throws SAXException{ </p>*<p align=”left”>try{ </p>


out.flush(); }catch (IOException e){throw new SAXException(“I/O error”, e);


public void startDocument () throws SAXException{ public void endDocument () throws SAXException {




try { out.flush();


<p align=”left”>catch (IOException e) {</p>throw new SAXException(“I/O error”, e);


public void startElement (String namespaceURI, String sName,String qName, Attributes attrs) throws SAXException {

String eName = sName;

<p align=”left”>if (“”.equals(eName)) eName = qName; </p>

if(eName.equals(“a”)) a1 = true;</p></strong>if(eName.equals(“b”)) b1 = true;if(eName.equals(“c”)) c1 = true;


public void endElement (String namespaceURI, String sName, String qName) throws SAXException {

String eName = sName;

<p align=”left”>if (“”.equals(eName)) eName = qName; </p>

if(eName.equals(“a”)) a1 = false;</p></strong>if(eName.equals(“b”)) b1 = false;if(eName.equals(“c”)) c1 = false;


public void characters(char[] chars,int startIndex, int endIndex) throws SAXException {

String dataString =

new String(chars, startIndex, endIndex).trim(); </p>+// CALL VALUE MAPPING TABLES FROM INTEGRATION DIRECTORY +

+String ValMappfromID = +

XIVMService.executeMapping(“Sender”, “SenderType”,dataString,”Receiver”,”ReceiverType”);

+if (a1) { +

+write(“” + ValMappfromID +”“); </strong><p align=”left”>*write(lineEnd);} </p><p align=”left”>if (b1) { </p><p align=”left”>write(“” + ValMappfromID “</b>”);write(</p>+lineEnd); <p align=”left”>}</p>if (c1) { write(“”);write(lineEnd); <p align=”left”>}}}+*

Value Mapping Maintained in ID:


Result in SXMB_MONI: Both Input and Ouput are shown.


To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply