Java Mapping Programs

Can somebody give me some  sample Java Mapping programs and also XSLT  mapping  programs?

Hi,
For different mapping scenarios check these blogs:-
/people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i
/people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
For Java Mapping, check these:-
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii
/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
Regards.
Praveen

Similar Messages

  • How to pass input parameter (parameterized mapping) to java mapping program

    Hello
    I have a question about the parameterized mapping with Java (PI 7.1).
    In the operation mapping (using Java-class) I defined a inputer parameter (string). I think I am supposed to retrieved the value using:
                    arg0.getInputParameters().getString("myInputParameterName");
    where arg0 is the TransformationInput object.
    However I am not able to get the value, I got runtime exception saying the inputer parameter doesn't exit.
    Then I figured out maybe I need to bind the OM input parameter to Java mapping parameter, just like in case of message mapping, you need to bind OM parameter to MM parameter. However there is no way to define input parameter for the java mapping program.
    Anybody has done java mapping with parameterized mapping?
    Anybody can give any hint for this?
    Thanks
    Jayson

    InputParameters params = container.getInputParameters();
    DynamicConfiguration conf = (DynamicConfiguration) params.getValue(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
    http://help.sap.com/saphelp_nwpi71/helpdata/en/43/03612cdecc6e76e10000000a422035/content.htm
    Edited by: Anand on Dec 10, 2008 4:13 PM

  • Error in Java Mapping program

    Hi friends,
    I am tryin java mapping for first time.. and created one java program using link https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field
    But when I am compiling it using JAVAC, I am getting following error message that
    package com.sap.aii.mapping.api does not exist . How can I solve this error.
    Complete error is as follows:
    C:j2sdk1.4.2_16-x64 in>javac PayloadToXMLField.java
    PayloadToXMLField.java:1: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformation;
                                   ^
    PayloadToXMLField.java:2: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.AbstractTrace;
                                   ^
    PayloadToXMLField.java:3: package com.sap.aii.mapping.api does not exist
    import com.sap.aii.mapping.api.StreamTransformationConstants;
                                   ^
    PayloadToXMLField.java:8: cannot resolve symbol
    symbol  : class StreamTransformation
    location: class PayloadToXMLField
    public class PayloadToXMLField implements StreamTransformation {
                                              ^
    PayloadToXMLField.java:16: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class PayloadToXMLField
        AbstractTrace trace;
        ^
    PayloadToXMLField.java:27: cannot resolve symbol
    symbol  : class AbstractTrace
    location: class PayloadToXMLField
                (AbstractTrace) param.get(
                 ^
    PayloadToXMLField.java:28: cannot resolve symbol
    symbol  : variable StreamTransformationConstants
    location: class PayloadToXMLField
                    StreamTransformationConstants.MAPPING_TRACE);
                    ^
    PayloadToXMLField.java:43: cannot resolve symbol
    symbol  : variable outputPayload
    location: class PayloadToXMLField
            outputPayload =
            ^
    PayloadToXMLField.java:50: cannot resolve symbol
    symbol  : variable outputPayload
    location: class PayloadToXMLField
                out.write(outputPayload.getBytes());
                          ^
    9 errors
    Thanks,
    Brijesh Soni

    thanks , it is done now..
    the program is compiled properly and class file is generated.
    but m gettin error in mapping.
    in IR i created two message type  with data type as string.
    and i had imported the class file and java program using Imported archives.
    now in interface mapping mapping program i had selected type as Java Class.and name of java program.
    but when i tested it, it is giving error as Linkage error occurred when loading class zip/PayloadToXMLField
    Please suggest, M i doing some thing wrong?is any thing missing?
    Program tht i had used in java
    from link (https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field):
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import java.util.Map;
    import java.io.*;
    public class PayloadToXMLField implements StreamTransformation {
        String strXML = new String();
        String outputPayload = new String();
         //Declare the XML tag for your XML message
         String StartXMLTag = "<Payload>";
         String EndXMLTag = "</Payload>";
        AbstractTrace trace;
        private Map param = null;
        public void setParameter(Map param) {
            this.param = param;
        public void execute(InputStream in, OutputStream out) {
            trace =
                (AbstractTrace) param.get(
                    StreamTransformationConstants.MAPPING_TRACE);
            trace.addInfo("Process Started");
            try {
                StringBuffer strbuffer = new StringBuffer();
                byte[] b = new byte[4096];
                for (int n;(n = in.read(b)) != -1;) {
                    strbuffer.append(new String(b, 0, n));
                strXML = strbuffer.toString();
            } catch (Exception e) {
                System.out.println("Exception Occurred");
            outputPayload =
                "<?xml version="1.0" encoding="UTF-8"?>"
                   + StartXMLTag
                   + strXML
                   + EndXMLTag;
            try {
                out.write(outputPayload.getBytes());
                   trace.addInfo("Process Completed");;
            } catch (Exception e) {
                trace.addInfo("Process Terminated: Error in writing out payload");;
    and detailed trace of error is:
    11:34:21 Start of test
    LinkageError at JavaMapping.load(): Could not load class: zip/PayloadToXMLField
    java.lang.NoClassDefFoundError: zip/PayloadToXMLField (wrong name: PayloadToXMLField) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.lang.ClassLoader.defineClass(ClassLoader.java:448) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingLoader.findClass(RepMappingLoader.java:175) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.load(RepJavaMapping.java:136) at com.sap.aii.ibrep.server.mapping.ibrun.RepJavaMapping.execute(RepJavaMapping.java:50) at com.sap.aii.ibrep.server.mapping.ibrun.RepMappingHandler.run(RepMappingHandler.java:80) at com.sap.aii.ibrep.server.mapping.rt.MappingHandlerAdapter.run(MappingHandlerAdapter.java:107) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInterfaceMapping(ServerMapService.java:127) at com.sap.aii.ibrep.server.mapping.ServerMapService.transform(ServerMapService.java:104) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.transform(MapServiceBean.java:40) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.transform(MapServiceRemoteObjectImpl0_0.java:167) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:104) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:319) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:200) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:136) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    11:34:21 End of test

  • Keystore access in Java Mapping Program - user J2EE_GUEST

    Dear Gurus,
    I have the following problem:
    I need to validate the digital signature of a XML document and I'm using some examples provided by SAP as follows:
              InitialContext ctx = ctx = new InitialContext();          
              Object o = (Object) ctx.lookup("keystore");          
              KeystoreManager manager = (KeystoreManager) o;          
              KeyStore ks = manager.getKeystore("Serasa");
    {/code}
    But I get the error below, saying that user J2EE_GUEST is not authorized. How do I change the user who executes java mapping, because I granted permissions in Visual Admin to another user.
         at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131)
         at sun.reflect.GeneratedMethodAccessor267.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:62)
         at java.lang.reflect.Method.invoke(Method.java:391)
         at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187)
         at $Proxy218.processFunction(Unknown Source)
         at sun.reflect.GeneratedMethodAccessor266.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:62)
         at java.lang.reflect.Method.invoke(Method.java:391)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.call(RFCDefaultRequestHandler.java:284)
         at com.sap.engine.services.rfcengine.RFCDefaultRequestHandler.handleRequest(RFCDefaultRequestHandler.java:219)
         at com.sap.engine.services.rfcengine.RFCJCOServer$J2EEApplicationRunnable.run(RFCJCOServer.java:254)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(AccessController.java:219)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    Caused by: com.sap.engine.services.keystore.exceptions.BaseKeystoreException: User is not authorized to execute keystore operation[{GET_VIEW Serasa }]
         at com.sap.engine.services.keystore.impl.security.UserBasedSecurityConnector.checkUserPermission(UserBasedSecurityConnector.java:889)
         at com.sap.engine.services.keystore.impl.security.SecurityRestrictionsChecker.checkUserPermission(SecurityRestrictionsChecker.java:52)
         at com.sap.engine.services.keystore.impl.security.SecurityRestrictionsChecker.isUserAuthorized(SecurityRestrictionsChecker.java:148)
         at com.sap.engine.services.keystore.impl.security.SecurityRestrictionsChecker.checkPermission(SecurityRestrictionsChecker.java:174)
         at com.sap.engine.services.keystore.impl.ParameterChecker.checkPermission(ParameterChecker.java:35)
         at com.sap.engine.services.keystore.impl.KeystoreManagerImpl.checkPermission(KeystoreManagerImpl.java:46)
         ... 28 more
    Caused by: java.security.KeyStoreException: (thread: SAPEngine_Application_Thread[impl:3]_56,view:Serasa, entry: , user: J2EE_GUEST) - checkPermissions  'getView': com.sap.engine.services.security.exceptions.BaseSecurityException: Caller not authorized.
         at com.sap.engine.services.keystore.impl.security.UserBasedSecurityConnector.checkFailed(UserBasedSecurityConnector.java:1097)
         at com.sap.engine.services.keystore.impl.security.UserBasedSecurityConnector.checkPermissions_getView(UserBasedSecurityConnector.java:773)
         at com.sap.engine.services.keystore.impl.security.UserBasedSecurityConnector.checkUserPermission(UserBasedSecurityConnector.java:823)
         ... 33 more
    {/code}
    Thank you very much

    Hi Fabio,
    first of all have you checked if standard functions to verify digital signature for pi adpaters would work for you?
    We have used the following code to access the Keystore in a custom adapter. It accesses the keystore with the access rights of a JEE application (it has a reference to the sample adapter "sap.com/com.sap.aii.adapter.sample.ra"). Check out if it works in your mapping, too.
    import java.security.Key;
    import java.security.KeyStore;
    import java.security.KeyStoreException;
    import java.security.NoSuchAlgorithmException;
    import java.security.PublicKey;
    import java.security.UnrecoverableKeyException;
    import java.util.HashMap;
    import java.util.Map;
    import javax.resource.ResourceException;
    import com.sap.aii.af.service.resource.SAPSecurityResources;
    import com.sap.aii.security.lib.KeyStoreManager;
    import com.sap.aii.security.lib.PermissionMode;
    public class XIKeystoreAccessor {
        private static final XITrace TRACE = new XITrace(XIKeystoreAccessor.class.getName());
        static XIKeystoreAccessor instance = null;
        SAPSecurityResources securityResources;
        KeyStoreManager keystoreManager;
        Map<String, KeyStore> keystores = null;
        private XIKeystoreAccessor() throws ResourceException {
         final String SIGNATURE = "XIKeystoreAccessor()";
         TRACE.entering(SIGNATURE);
         keystores = new HashMap<String, KeyStore>();
         securityResources = SAPSecurityResources.getInstance();
         try {
             keystoreManager = securityResources.getKeyStoreManager(PermissionMode.SYSTEM_LEVEL,
                  new String[] { "sap.com/com.sap.aii.adapter.sample.ra" });
         } catch (KeyStoreException e) {
             TRACE.catching(SIGNATURE, e);
             throw new ResourceException(e);
         TRACE.exiting(SIGNATURE);
         * Get a key from AS Java keystore
         * @param view
         * @param alias
         * @param password
         * @return
         * @throws ResourceException
        public Key getPrivateKey(String view, String alias, String password) throws ResourceException {
         final String SIGNATURE = "getPrivateKey()";
         TRACE.entering(SIGNATURE);
         KeyStore keystore = getKeystore(view);
         Key privateKey = null;
         try {
             privateKey = keystore.getKey(alias, password.toCharArray());
             if (privateKey == null) {
              throw new ResourceException("Key not found. alias=" + alias);
         } catch (KeyStoreException e) {
             TRACE.catching(SIGNATURE, e);
             throw new ResourceException(e);
         } catch (NoSuchAlgorithmException e) {
             TRACE.catching(SIGNATURE, e);
             throw new ResourceException(e);
         } catch (UnrecoverableKeyException e) {
             TRACE.catching(SIGNATURE, e);
             throw new ResourceException(e);
         TRACE.exiting(SIGNATURE);
         return privateKey;
        public PublicKey getPublicKey(String view, String alias) throws ResourceException {
         final String SIGNATURE = "getPublicKey()";
         TRACE.entering(SIGNATURE);
         KeyStore keystore = getKeystore(view);
         PublicKey publicKey = null;
         try {
             publicKey = keystore.getCertificate(alias).getPublicKey();
             if (publicKey == null) {
              throw new ResourceException("Key not found. alias=" + alias);
         } catch (KeyStoreException e) {
             TRACE.catching(SIGNATURE, e);
             throw new ResourceException(e);
         TRACE.exiting(SIGNATURE);
         return publicKey;
         * Get a keystore i.e. a view from AS Java
         * @param view
         * @return
         * @throws ResourceException
        public KeyStore getKeystore(String view) throws ResourceException {
         final String SIGNATURE = "getKeystore()";
         TRACE.entering(SIGNATURE);
         KeyStore keystore;
         try {
             if (keystores.containsKey(view) == true) {
              keystore = keystores.get(view);
             } else {
              keystore = keystoreManager.getKeyStore(view);
              if (keystore == null) {
                  throw new ResourceException("Keystore not found. view=" + view);
              keystores.put(view, keystore);
             TRACE.exiting(SIGNATURE);
             return keystore;
         } catch (KeyStoreException e) {
             TRACE.catching(SIGNATURE, e);
             throw new ResourceException(e);
        static public XIKeystoreAccessor getInstance() throws ResourceException {
         if (instance == null) {
             instance = new XIKeystoreAccessor();
            return instance;

  • RFC Lookup using Java Mapping program - Examples

    Dear Experts,
    I am working on a scenario which is using 1:N mapping. For deciding the target message I have to use RFC Lookup to call the backend ERP system and there are 2 ERP systems involved in this integration. As I am using Java Mapping and never did a RFC Lookup in Java. I kindly request you to give me some examples which I could use for my RFC calls in my Java Mapping. Simple example will do.
    Client is adamant to use Java mapping, I could achieve this easily using XSLT or Graphical Mapping.
    Advance Thanks,
    Pradeep

    Hello,
    why don't you use Extended Receiver Determination Defining Extended (Dynamic) Receiver Determination - Integration Directory - SAP Library?
    What you can do is create a Message Mapping between your source message and Receivers message type. In this message mapping you can use your RFC to generate the target message.
    For example, lets say we have the function ZFM_GET_INTERFACE_INFO used to generate the List of Receivers given a source message. You could create a Message Mapping as below:
    In this case, the RFCLookup box look as below:
    The receiver determination configuration would look as follows:
    Afterwards, you will need two specific message mappings for the two ERP systems.
    Summarizing, you'll need:
    1.- A Message Mapping: Source Message to Receivers Message Type (This one uses the RFC Lookup)
    2.- A Message Mapping: Source Message to Target Message for ERP 1
    3.- A Message Mapping: Source Message to Target Message for ERP 2
    In Integration Directory you'll have 1 Receiver Determination(Source system, Target System determined Dynamically) and 2 Interface Determinations (Source System to ERP1, Source System to ERP2), etc.
    I hope you find it useful.
    Regards!

  • Java Class Mapping Program in BPM process

    I have a scenario where I'm receiving an IDOC I then use a JAVA mapping program in my first transformation step.  Immediately following I have a switch step but there is not data in from the mapping program.
    1) Receive Step
    2) Transformation IDOC to Table using Java class
    3) Switch step based on Table field value
    Problem is there is no values in the table. 
    This java class was not developed within NetWeaver but was used in our old process. We simply imported the jar file for accessing our existing java classes.  Is there something else we need to do to utilize our java modules within the BPM process?

    Hi,
    You must to have in the java class:
    - You java have to be like:
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import java.util.HashMap;
    import com.sap.aii.mapping.api. AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    public class JavaMapping implements StreamTransformation {
       private Map           param = null;
       private AbstractTrace  trace = null;
       public void setParameter (Map param) {
          this.param = param;
          if (param == null) {
             this.param = new HashMap();
       public void execute(InputStream in, OutputStream out) {
    try {
             trace = (AbstractTrace)param.get(
                       StreamTransformationConstants.MAPPING_TRACE );
             trace.addInfo(‘...’);
             String receiverName = (String)param.get(
                       StreamTransformationConstants.RECEIVER_NAME);
    The method execute take the InputStream with the XML source. The out (OutputStream) have to be an XML like the IDOC structure.
    Regards.

  • Accessing a File in a Java Mapping

    Hi,
    I am accessing one Random Access File through Java Mapping Program. This is working fine in Eclipse.
    But when I imported that jar file to IR, it is throwing FileNotFound Exception while trying to test through Interface Mapping.
    Actually it is not showing any error message but by research I understood that. Can any one please help me in this regard?
    One more thing, I used the same scenario for other interface. It is working fine.
    Please help me to chase this mistery.
    Thanks,
    Yogi.

    Hi,
    I think I am giving relative path only not direct path. I am just mentioning the path from my proj name. I am not specifying any local directories. For your Information, I am mentioning the path like below:
    "ProjectName/SomeName/File_Name.txt"
    Thanks,
    Yogi.

  • Issue with java mapping in a multi-mapping scenario

    Hi
        We have  a 1:n multiple mapping scenario in XI and the source is R3 proxy and target side is files. So, creating multiple file from a single message from R3 .
    R3 --> XI --> Multiple files
    Structure of the output of the multi-mapping is
    - <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
    - <ns0:Message1>
    <Transaction>
    </Transaction>
    <Transaction>
    </Transaction></ns0:Message1>
    </ns0:Messages>
    wherein each Transaction node represents a file.
    Now, we need to introduce a constant /string like
    <!DOCTYPE Transaction PUBLIC \"-//XXXXXX//DTD BatchReceiptAuthorization//EN\" \"http://dtd.XXXXXXX.com/dtds/ReceiptAuthorization.dtd\">
    on each of the files at the very beginning - i.e within each transaction node , in the above structure, we need the above DTD string to be written.  To do this, we added a java mapping as the second mapping after the message mapping that creates this string. Is this the right approach and would it produce what we are expecting ?
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.util.Map;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.DynamicConfiguration;
    import com.sap.aii.mapping.api.AbstractTrace;
    public class ModifyRootAndDelay implements StreamTransformation {
         AbstractTrace myTrace;
    public void execute(InputStream input, OutputStream output) throws StreamTransformationException {
              try{
                   BufferedReader reader = new BufferedReader(new InputStreamReader(input));
                   String NameSpacePrefix = "<!DOCTYPE Transaction PUBLIC \"-//innotrac//DTD BatchReceiptAuthorization//EN\" \"http://dtd.innotrac.com/dtds/ReceiptAuthorization.dtd\">";
                   String sLine = null;
                   StringBuffer XmlMsg= new StringBuffer();
                   String Result,PayloadBody;
                   int indexOfFirst;
                   while ((sLine = reader.readLine()) != null) {
                        XmlMsg.append(sLine);
                   String StartingTag = XmlMsg.toString();
                   indexOfFirst = StartingTag.indexOf("<MerchantID>") ;
                   PayloadBody=new String(XmlMsg.substring(indexOfFirst));
                   Result=NameSpacePrefix.concat(PayloadBody);
                   output.write(Result.getBytes());
              /*     Thread.sleep(200000); */
              }catch(Exception e){
                   myTrace.addWarning("Exception raised in the JavaMapping:modifyNamespace.java""\n The Exception Message: " e.getMessage());
                   throw new RuntimeException(e.getMessage()) ;
            }     public void setParameter(Map param) {
              myTrace = (AbstractTrace) param
                        .get(StreamTransformationConstants.MAPPING_TRACE);

    Hi XI Gurus
                       In my scenario, I sent the inputstream that is being passed to the Java execute method - to trace and I see that the whole of the xml file - as shown below  - which is the output of message mapping ( from the first mapping step ) in sent to the execute method of the java mapping a single call
    <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
    <ns0:Message1>
    <Transaction> </Transaction>
    <Transaction> </Transaction>
    </ns0:Message1>
    <ns0:Messages>
    So, I modified Java mapping program to look for multiple occurences of <Transaction> tag and prefix them with my constant DTD Literal - which is the primary reason , why I had to use Java mappings after the message mapping.
    Now, I get an error is XI- SXMB_MONI
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING" />
      <SAP:P1>unexpected symbol; expected '<', '</', entity refe</SAP:P1>
      <SAP:P2>rence, character data, CDATA section, processing i</SAP:P2>
      <SAP:P3>0</SAP:P3>
      <SAP:P4>113</SAP:P4>
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>The exception occurred (program: CL_XMS_MAIN===================CP, include CL_XMS_MAIN===================CM00A, line: 609)</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Should I create multiple outputs - as many as the numberof target split files ( of type outputstream ) from the execute method in the java program ?

  • Xerces for XSD 1.1 Validation not working in Java Mapping

    Hi Experts,
    We are trying to use XSD 1.1 (assertion feature) validation for the XML payload in a Java mapping program. But I am getting the following exception:
    java.lang.IllegalArgumentException: http://www.w3.org/XML/XMLSchema/v1.1 at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:186)
    This is happing for the statement:
    SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/XML/XMLSchema/v1.1");
    The reason (apparently) is because it is not able to instantiate the class org.apache.xerces.jaxp.validation.XMLSchema11Factory , which is the Xerces implementation of the SchemaFactory class.
    I have tried following things so far -
    1. If I try to validate an xml against an xsd 1.1 schema in a standalone program, it works perfectly fine.
    2. If I try to deploy this whole functionality on to the server through an EAR (like an adapter module), there again it works.
    3. Also tried this before instantiating the SchemaFactory -
    System.setProperty("javax.xml.validation.SchemaFactory:http://www.w3.org/XML/XMLSchema/v1.1","org.apache.xerces.jaxp.validation.XMLSchema11Factory");
    4. I tried by creating the Imported Archive objects for all the Xerces jars that we require for validation, within the same SWCV, namespace. But still I get the same exception as above (IllegalArgumentException)
    5. The link [http://help.sap.com/saphelp_nw70/helpdata/en/b6/8097f5a5edea4f8dfc87ac87082b22/content.htm ] mentions that we need to place all the necessary jars at location <SAP_J2EE_Engine_install_dir>/cluster/server/bin/ext /. But even after placing the jars there, I get the same exception.
    I am not sure how we need to handle this. Has anybody faced a similar situation? Any suggestions?
    Regards,
    Sudheer

    Hi Stefan,
    Thanks for the reply.
    We are on PI 7.1 SP 06. The standard XML tools from jdk supports only XSD 1.0, as far as I know. And XSD 1.0 does not have the Assert feature (also known as, co-occurrence constraint). More details are provided here - [http://www.ibm.com/developerworks/library/x-xml11pt2/]
    To use XSD 1.1, we need a different implementation like Xerces-J. I am not sure how we can use it without external jars. I would like to mention again that I could achieve this by using an adapter module (EAR containing the jars), but I need to do this in Java Mapping (imported archive).
    Do you know how we can achieve this in any other way? Any other suggestions welcome.
    Thanks & Regards,
    Sudheer

  • Java Mapping XML Encoding Error.

    Hi All,
    I hav an IDoc XML coming out of R/3 whose encoding technique is UTF-8. I hav to change it to ISO-8859-1 before parsing the xml in the java mapping program. i have seen this problem repeating among many people but i cud not find any solution on the SDN. Can any one help me out in this regard?
    Thnx in Adv.
    Anil

    Hi Anil,
    put following XSLT a first place of interface mapping:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
         <xsl:output encoding="ISO-8859-1"/>
         <xsl:template match="/">
              <xsl:copy-of select="*"/>
         </xsl:template>
    </xsl:stylesheet>
    Regards,
    Udo

  • Strange problem with jars in Java Mapping

    Hi All,
    I'm trying to implement a Java Mapping that uses Xerces. I'm using xercesImpl.jar.
    I put the xercesImpl.jar file in the folder containing the .class file (the Java Mapping program), and zipped the folder.I imported the zip file as an archive and used it in the Interface Mapping.
    My code uses the org.apache.xerces.parsers.<b>SAXParser</b> class.
    However, while trying to execute the Interface Mapping, it gives error: <b>Unable to find resource:'org/apache/xerces/parsers/SAXParser.class'</b>.
    The same method works when I'm using xerces.jar and using classes javax.xml.parsers.<b>DocumentBuilder</b> and
    javax.xml.parsers.DocumentBuilderFactory.
    I can't figure out what the problem is.
    Any ideas?
    Regards,
    Puloma.

    Hi All,
    I tried all the methods suggested. Mow my problem is that I get the following error, when I try to instantiate the SAXParser class:
    Unable to find resource:
    <b>META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration</b>
    The XMLParserConfiguration class is actually in org.apache.xerces.xni.parser. Why does XI try to find it in the wrong sub-directory?
    My code works just fine on standalone.
    Regards,
    Rahul.

  • How TO Use Java Mapping In XI

    Hi Experts,
    please help me ,
    How TO Use Java Mapping In XI?
    Thanks
    Mahesh

    Hi,
    Just refer the following links for java mapping:-
    1./people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs
    2./people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    Regards,
    Ashwin M
    Reward if helpful

  • Without BPM:Call RFC using JCO in interface mapping using java mapping

    Hi all
    I have a very small scenario where REQUEST from the customer comes via Web Service all i have to do is to read the request using SOAP adapter and call an interface mapping(lets say the name is IM_TEST) inside which there is a JAVA MAPPING program written which will call an RFC in CRM using JCO.
    Now this was really simple and i cud test the Interface mapping successfully, but the problem is when loading the scenario in integration directory i have certain things to do
    1. to set the SENDER AGREEMENT which i did correctly
    2. set the RECEIVER DETERMINATION, INTERFACE DETERMINATION AND RECEIVER AGREEMENT now here i am stuck because there is no receiver in my case as the RFC is called inside the mapping only.
    can i call one more message mapping in IM_TEST which will write file onto the XI directory and then in RECEIVER DETERMINATION, INTERFACE DETERMINATION AND RECEIVER AGREEMENT i can mention the reciever as FTP.
    I tried it but i gives the following error
    Runtime exception occurred during execution of application mapping program com/sap/xi/tf/_MM_TEST_WRITE_FILE: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Parsing an empty source. Root element expected!
    Please help me how to complete the scenario so that customer can run it end to end.
    <REMOVED BY MODERATOR>
    Edited by: Prateek Raj Srivastava on May 12, 2010 1:44 PM

    Stefen
    What do i do then...actually this is the project requirement. They want a very fast response from PI and thats why they wnt us to omit BPM and the Graphical mapping from the scenario.
    I am able to test the interface mapping which calls the the Java mapping inside which there is an RFC call, but i cannot implement it end - to - end as there is no receiver business system in this case. The only business system i have is the SOAP sender.
    I am really troubled now, please help me with a solution.
    Is there any other possible way through which the process can become very fast whic hcan meet their requirement.
    Regards
    Naina

  • Usage of java mapping

    Hi experts,
    I want to know a scenario whare java mapping is the preferred mapping method rather than graphical mappings. please provide me some examples
    thanks

    hi sudhakar,
    check this blogs"very helpful"
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/50ce0433-4309-2b10-4bb4-d421e78463f7
    Java Mapping (Part I)
    Java Mapping (Part II)
    Java Mapping (Part III)
    The specified item was not found.
    Using JAXP to both parse and emit XML in XI Java mapping programs
    regards
    srinu

  • XML not well formed - Java Mapping, Webservice to RFC Scenario

    Hello All Experts,
    I have facing a strange type of error. I have written a Java Mapping which implements a DOM parser to take a request from a Webservice and validate it on the basis of some prerequisites. i.e. If data in the incoming request is valid, it creates a message of the same structure type as the input. If the incoming data is incorrect or incomplete; It generates an Error response structure.
    When I run and test the same mapping program using Editplus Java editor for the error scenario; it executes perfectly and creates the correct error XML structure. (I checked it by importing the structure in the XI Message mapping test tab). But when I create jar of my java mapping program and test it in my interface mapping, it gives me "XML not well formed error" (Problem while building the tree).
    Any idea as to why is it behaving in such a way? There are 2 reasons which come to my mind as of now:
    1. The initilization of my input and output streams in the public static void main:
                InputStream in = new FileInputStream(new File("Input.xml"));
               OutputStream out = new FileOutputStream(new File("Output.xml"));
               validateXML myMapping = new ValidateXML();
                myMapping.execute(in, out);
    The Output.xml has the xml structure for the correct case, do I have to initialize my outputstream for the error file? say error.xml
    2. My Webservice interface is a sychronous interface (Request / Response) and output of the Java mapping program are two asynchronous interface. (I'll use a synch-asynch bridge when this works) - Is that causing a problem?
    Please help.
    Best regards,
    Varun

    Hello Varun,
    it gives me "XML not well formed error" (Problem while building the tree).
    I have come across the same error message while testing in interface mapping. My problem was when an exception occured in java mapping, the execution terminates with the messages XML not well formed error". In order to solve this issue what i did was catch the exception type TransformerException and in that catch block throw StreamTransformationException exception in main methos of mapping program i.e execute().
    eg:-                                                                               
    catch (TransformerException e) {
                   throw new StreamTransformationException("Can not write XML.", e);
    By doing this you will see the exception raised , because some times when you execute your mapping with mail() method, though it create the file, when you try to open it will give error if any exceptions occured in mapping. By using the above notation you can handle those in java mapping.
    Hope you have gone through this blog.
    [Handling and Tracing Exceptions in java mapping|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417700)ID1055371050DB01666765031379427182End?blog=/pub/wlg/15061]
    Regards,
    Prasanna

Maybe you are looking for

  • Two different Resultsets for the same query (running at the same time)

    I am using the Thin Driver for Oracle 8.1.6. I am invoking queries in multithreading mode (each thread has his own connection to the oracle DB). If i am invoking the same SQL-Statement in two different threads nearly at the same time, only the Result

  • Value in data type p filed not displayed properly

    Hi, One of my programs downloads a file to UNIX server, here the data which i am downloading, one of the fields is of type P (it is of domain type DEC). The field displays very strangecharactershen i view it in UNIX server. I am using OPEN DATASET in

  • How can I upgrade poral 3.0.7 to 3.0.9 ?

    How can I upgrade poral 3.0.7 to 3.0.9 .Is there any patch which can do this and where can I download it ?

  • Time Machine - Restoring Files only to a fresh install of OSX

    Hi folks, had my 17' MBP for about a year now and love it, although in the last couple of month it's become frightening slow, jerk video playback and what not. So I'd like to Format the Mac and re-install Snow Leopard to get full performance back, I

  • Ingesting P2 nightmare

    I'm trying to help a friend who shot on a Panasonic AG-HVX200 on P2 cards at 720p/30p. I'm running into a few problems. For one thing, it's ingesting at 23.97 and the compressor is set for 1080i/60 -- this is causing the video to playback in slow mot