Problem in SAX Java mapping

Hi,
I'm using SAX Java mapping in one scenario. Problem is when I get some Croatina characters, like Đ or u0160,
output XML is not valid. XML Spy complains, IE complains and so on. Customer is sure  that data ( XML in CLOB field in Oracle DB) is UTF-8? What could be a problem?
What I'm doing is reading entire XML into string with help of BufferedReader, then do some manipulation and write String into byte array with:
               byte[] bytes = file.toString().getBytes("UTF-8");
               saxParser.parse(new ByteArrayInputStream(bytes), handler);
and then of course parse XML. readLine method reads data and problematic is "Ä�" - ￯0 - 0xC490.
For this character XML Spy doesn't complain, IE also. After conversion, this character looks like "Ä?" - 0xC43F, and this is not good any more. Why?

Hi Stefan,
I've finally done it. Code as foollws:
     public void execute(InputStream in, OutputStream out)
               throws com.sap.aii.mapping.api.StreamTransformationException {
          DefaultHandler handler = this;
          SAXParserFactory factory = SAXParserFactory.newInstance();
          try {
               SAXParser saxParser = factory.newSAXParser();
               fStreamOut = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
               encoding = "UTF-8";
               if (map != null) {
                    mappingTrace = (MappingTrace) map
                              .get(StreamTransformationConstants.MAPPING_TRACE);
               InputStreamReader is = new InputStreamReader(in, "UTF8");
               BufferedReader reader = new BufferedReader(is);
               StringBuffer file = new StringBuffer();
               String line = new String();
               try {
                    while ((line = reader.readLine()) != null) {
                         file.append(line);
               } catch (IOException e) {
                    e.printStackTrace();
               } finally {
                    try {
                         in.close();
                    } catch (IOException e) {
                         e.printStackTrace();
               Date d4 = new Date();
               file = replaceREGEX(
                         "<\\?xml version=\"1\\.0\" encoding=\"UTF-8\"\\?>", "",
                         file);
               char[] cArray = file.toString().toCharArray();
               Date filedat = new Date();;
               SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd_HHmmss_SSS");
               String fName = df.format(filedat) + "_El_Invoice.xml";
               Writer out1 = new BufferedWriter(new OutputStreamWriter(
                         new FileOutputStream(fName), "UTF8"));
               try {
                    out1.write(file.toString().toCharArray());
                    out1.close();
               } catch (UnsupportedEncodingException e) {
               } catch (IOException e) {
               saxParser.parse(fName, handler);
               File outFile = new File(fName);
               outFile.delete();
          } catch (Throwable t) {
               if (mappingTrace != null) {
                    mappingTrace.addInfo(t.toString());
               t.printStackTrace();
problem was also in method for writing in output stream, so I've changed it:
     private void printOutPut(String sOP) {
          try {
                  //    fStreamOut.write(sOP.getBytes());
               fStreamOut.write(sOP);
          } catch (IOException e) {
               e.notify();

Similar Messages

  • Problem in Uploading Java mapping Code

    Hi Guys,
                  I never work on Java mapping before, i got the code required for my progrmme in these forums.So i saved it as a text file. now i want to import that fileintomy programme as Java class. i think i have to use Netweaver Studio. what exactly i have o do it.
    Thanks in advance.
    Kartik

    Hello Kartik,
    If your code is handling the Required Mapping.Then what is you need to do is  :
    Create the Jar file using any Java IDE (or) use Netweaver developer studio.
    Before creating the u201Cjaru201D file just make sure that the "path" of the class file in the imported archive. It should be the
    same as your "package" path.
    Once the class file is created, we have to create the jar file with all the necessary files. After creating the jar file, it
    has to be deployed to XI.
    Import the Jar file using Imported Archive  in IR under Mapping Objects.
    See this blog it explains how to load :
    Java Mapping (Part III)
    After doing the necessary setps you can test the Mapping.
    regards
    Gangaprasad

  • Problems with a Java Mapping

    Hi Experts,
    as part of my diploma-thesis I have to write a java SAX-Mapping, which mapps the following incoming message:
    mt_MappingOUT
                 set
                     set_Element_01
                     set_Element_02
                     set_Element_03
                     set_Element_10
    to the following outgoinig message:
    mt_MappingIN
                  TABLE
                        item
                            item_FIELD_01
                            item_FIELD_10
    I develped the following code, which unfortunately results in "XML is not well defined" while testing. Unfortunately I cannot find the problem. So I hope someone of you can have a look an will have an idea.
    Created on 20.12.2007
    @author Sebastian Geissler
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import com.sap.aii.mapping.api.*;
    import java.io.*;
    import java.util.Map; import javax.xml.parsers.*;
    import org.xml.sax.; import org.xml.sax.helpers.;
    public class SETtoITEMjavaSAX extends DefaultHandler implements StreamTransformation
         private Map map;
         private OutputStream out;
         public void setParameter (Map param)
              map = param;
         public void execute (InputStream in, OutputStream out)
         throws com.sap.aii.mapping.api.StreamTransformationException
              DefaultHandler handler = this;
              SAXParserFactory factory = SAXParserFactory.newInstance();
              try
                   SAXParser saxParser = factory.newSAXParser();
                   this.out = out; saxParser.parse(in, handler);
              catch (Throwable t)
                   t.printStackTrace();
         private void write (String s) throws SAXException
              try
                   out.write(s.getBytes()); out.flush();
              catch (IOException e)
                   throw new SAXException("I/O error", e);
         public void startDocument () throws SAXException
              write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              write("<ns0:mt_MappingIn xmlns:ns0=\"urn:agrp:xi:geissseb\"><TABLE>");
         public void endDocument () throws SAXException
              write("</TABLE></ns0:mt_MappingIn>");
              try { out.flush();
              catch (IOException e) {
                   throw new SAXException("I/O error", e);
         public void startElement (String namespaceURI, String sName, String qName, Attributes attrs)
         throws SAXException
              String eName = sName;
              if ("".equals(eName))
                   eName = qName;
              if(eName.equals("set"))
                   write("<item>");
              if(eName.substring(0,6).equals("set_E"))
                   write("<item_FIELD"eName.substring(10,13)">");
         public void endElement (String namespaceURI, String sName, String qName) throws SAXException
              String eName = sName;
              if ("".equals(eName))
                   eName = qName;
              if(eName.equals("set"))
                   write("</item>");
              if(eName.substring(0,6).equals("set_E"))
                   write("</item_FIELD"eName.substring(10,13)">");
         public void characters (char buf[], int offset, int len)
         throws SAXException {
              String s = new String(buf, offset, len);
              write (s);
    Thank you,
    Sebastian

    Hi  Ravi, hi Raman,
    thanks so far... I did some changes in my code, but I am still having the same problem... down there you will find my new code and the source message.
    there is my new code:
    private Map map;
         private OutputStream out;
         public void setParameter (Map param)
                   map = param;
         public void execute (InputStream in, OutputStream out)
         throws com.sap.aii.mapping.api.StreamTransformationException
              DefaultHandler handler = this;
              SAXParserFactory factory = SAXParserFactory.newInstance();
              try
                   SAXParser saxParser = factory.newSAXParser();
                   this.out = out; saxParser.parse(in, handler);
              catch (Throwable t)
                   t.printStackTrace();
         private void write (String s) throws SAXException{
              try{
                   out.write(s.getBytes()); out.flush();
              catch (IOException e){
                   throw new SAXException("I/O error", e);
         public void startDocument () throws SAXException{
              write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
              write("<ns0:mt_mappingOUT xmlns:ns0=\"urn:agrp:xi:geissseb\"><TABLE>");
         public void endDocument () throws SAXException {
              write("</TABLE></ns0:mt_mappingOUT>");
              try { out.flush();
              catch (IOException e) {
                   throw new SAXException("I/O error", e);
         public void startElement (String namespaceURI, String sName, String qName, Attributes attrs)
         throws SAXException {
              String eName = sName;
              if ("".equals(eName))
                   eName = qName;
              if(eName.equals("mtset"))
                   write("<item>");
              if(eName.substring(0,2).equals("se"))
                   write("<Item_FIELD_"eName.substring(13,14)">");
         public void endElement (String namespaceURI, String sName, String qName) throws SAXException {
              String eName = sName;
              if ("".equals(eName))
                   eName = qName;
              if(eName.equals("mtset"))
                   write("</item>");
              if(eName.substring(0,2).equals("se"))
                   write("</item_FIELD_"eName.substring(13,14)">");
         public void characters (char buf[], int offset, int len)
         throws SAXException {
              String s = new String(buf, offset, len);
              write (s);
    and there is the source message:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:agrp:xi:geissseb" targetNamespace="urn:agrp:xi:geissseb">
         <xsd:element name="mt_MappingOut" type="dt_MappingOut" />
         <xsd:complexType name="dt_MappingOut">
              <xsd:annotation>
                   <xsd:appinfo source="http://sap.com/xi/TextID">
                   4c79fbb0bde711dcae43001a4b0af224
                   </xsd:appinfo>
              </xsd:annotation>
              <xsd:sequence>
                   <xsd:element name="set">
                        <xsd:annotation>
                             <xsd:appinfo source="http://sap.com/xi/TextID">
                             0b366510aeda11dcb3bb00174205b856
                             </xsd:appinfo>
                        </xsd:annotation>
                        <xsd:complexType>
                             <xsd:sequence>
                                  <xsd:element name="set_ELEMENT_01" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366511aeda11dcaf2600174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_02" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366512aeda11dc84d400174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_03" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366513aeda11dcbcab00174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_04" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366514aeda11dc96a300174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_05" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366515aeda11dca77700174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_06" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366516aeda11dc8f7d00174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_07" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366517aeda11dcc24b00174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_08" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366518aeda11dc92cd00174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_09" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b366519aeda11dcc9b100174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                                  <xsd:element name="set_ELEMENT_10" type="xsd:string">
                                       <xsd:annotation>
                                            <xsd:appinfo source="http://sap.com/xi/TextID">
                                            0b36651aaeda11dcc5a700174205b856
                                            </xsd:appinfo>
                                       </xsd:annotation>
                                  </xsd:element>
                             </xsd:sequence>
                        </xsd:complexType>
                   </xsd:element>
              </xsd:sequence>
         </xsd:complexType>
    </xsd:schema>
    I really hope you can help me there..
    Thanks in advance..
    Sebastian

  • JAVA Mapping with SAX: Illegal character exception &

    Hi everybody,
    I use a SAX JAVA Mapping. It throws an error cause the xml that is parsed has a
    &amp;
    like in
    <D_3036>Company &amp; Co. KG</D_3036>
    Does anybody know how to solve the problem?
    I do not want to replace the
    &amp;
    Are there special settings/properties for the handler/parser?
    Thanks
    Regards
    Mario

    Hi all,
    thanks for your comments and suggestions. The error was not cause by the problem I describes.
    FYI:
    If there is an ampersand in the middle of a string, than the standard method
    characters
    in the handler is called three times!
    This let me asume the ampersand was the error.
    Regards Mario
    Edited by: Mario Müller on Dec 19, 2008 1:23 AM

  • Java Mapping problem...

    Hi Guru’s,
    I am using the Java mapping in my XI system and it works fine in my Development.
    I just moved all my objects in to QA and I am getting some problem in my Java mapping.  It is not behaving like the dev the output format.
    Is their anything have to do for Java mapping while importing in to the QA system.
    I did the file transport and imported in to my QA.
    Please give me your comments and solution to resolve this issue.
    Thanks,
    Jane.

    Getting the below error in my response.
    - <ResponseMessage>
    - <Status>
      <StatusCode>500</StatusCode>
      <StatusText>Error while parsing the input</StatusText>
    - <Errors>
    - <Error type="Error">
      <ErrorMessage>Fatal Error: Internal server error - 1187224995259871</ErrorMessage>
      </Error>
      </Errors>
      </Status>
      </ResponseMessage>
    Thanks,
    Jane.

  • Handling Character Entities - Java Mapping Issue

    Hi Experts,
        I need to replace the character entities in my input XML. But, the problem is the java mapping I've written isn't replacing  the character entities as expected.  For example if my input XML  contains <NAME>&><XYZ</NAME>, then the ouput is <NAME>&amp:&gt:<0001&lt:/NAME>, whereas it should be <NAME>&amp:&gt:&lt:0001</NAME>.
    Note: I've used : instead of ; just to show it properly SDN.
    Can any of you share the code for the same if you've used it already?
    Thanks a lot in advance.
    Regards,
    Hussain.

    Hi Pooja,
        Thanks for your prompt reply.
    Are you trying to use the java mapping just to handle the character entities or your interface itself only has a java mapping?
                   - I'm using Java Mapping just to handle the character entities. Say my input XML looks like
    <?xml version="1.0" encoding="UTF-8"?>
    <resultset>
    <row>
    <ID>&<1</ID>
    <MESSAGE><![CDATA[<?xml version="1.0" encoding="UTF-8" ?><LGORT>&<0001</LGORT>]]></MESSAGE>
    </row>
    </resultset>
    I need to replace &< in <ID> to &amp:&lt: and similarly for CDATA <LGORT>&amp:&lt:0001</LGORT> before I process it in XI. In my java mapping I read the whole XML as string (line by line as mentioned below) and try to replace the character entities using some logic, which isn't working properly.
    StringBuffer buffer = new StringBuffer();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
    for (String lineRead = reader.readLine(); lineRead != null; lineRead = reader.readLine()) {
           buffer.append(lineRead);
    I've also checked the thread mentioned by Srinivas. But, StringEscapeUtils.escapeXml() would replace all the character entities like &lt:?XML... , which would result in an invalid xml...
    Please suggest.
    Thanks,
    Hussain.

  • Java Mapping with an xml array as input

    Hi Gurus,
    I have to perform a java mapping to map some input xml contained in an array with a target message type. I have found a good java mapping example here:
    Re: Please provide Java Mapping example
    but my mapping input is not a single XML, but an XML array, thus I have a doubt...
    How can I map multiple XML contained in an array with a target XML? I have to solve this problem into a Java mapping prospective.
    Thanks to all!
    Message was edited by:
            Gabriele Morgante

    Hey Stefan, I think he is refering to a n:1 multimapping.
    If that is indeed the case, Gabriele, you will have to consider the initial tags inserted by mapping runtime to treat multimappings.
    Suppose your XML message is like
    <myMT xmlns="urn:mynamespace">
      <value>xpto</value>
    </myMT>
    Then, if your source message interface occurrence is defined as unbounded in your interface mapping, your mapping program (message mapping, xslt, java mapping, whatever) will receive, from mapping runtime, a message like this:
    <Messages xmlns="http://sap.com/xi/XI/SplitAndMerge">
      <Message1>
        <myMT xmlns="urn:mynamespace">
          <value>xpto1</value>
        </myMT>
        <myMT xmlns="urn:mynamespace">
          <value>xpto2</value>
        </myMT>
        <myMT xmlns="urn:mynamespace">
          <value>xpto3</value>
        </myMT>
      </Message1>
    </Messages>
    Also, if you have more than 1 message type as source of your interface mapping, your mapping program will receive the other message types in <Message2>, <Message3>... tags.
    The <Messages> and <MessageX> tags will always be automatically generated by mapping runtime when dealing with multimappings, which are mappings from m XML messages to n XML messages, with either m, n or both different of 1 (note that this definition includes mappings from 1 type to 1 type, when either source, target or both message types have max occurrence = ubounded).
    Finally, remember that the output that your mapping program generates will also have to include these <Messages> and <MessageX> tags (with proper namespace), since mapping runtime will be expecting them. Message mappings treat those by default, but your xslt and java multimappings will have to explicitely include these tags in the output.
    Regards,
    Henrique.

  • Use java mapping class on PI 7.0

    Hi experts,
    I have a problem with a java mapping class on PI 7.0, maybe somebody could help me.
    I have a java mapping that call a webservice using AXIS library. If I run on my PC the java mapping is working. I load on Imported Archive the Java mapping class and AXIS librarys. My Java mapping class is compilated by jdk 1.4.2.09, like others java mappings that i have on PI 7.0 system, but when I execute the interface, its returns an error:
    Incompatible class versions (linkage error)
    This error is caused by AXIS Libraries, I use AXIS 1.4 version, and I think that this version is using jdk 1.5 because I read it on some foros. Could somebody confirm it? If it is true, could somebody tell me if there are some AXIS version that use jdk 1.4 or maybe How could I solved it? Thanks.
    Regards,
    Gemma

    Incompatible class versions (linkage error)
    this is usually when the jdk version of XI server and the library version you used to develop the mapping are incompatible. Make sure you use the same version as of the server

  • Problem in Java Mapping

    Hi,
          I was trying out a simple Java mapping example.
    Example of source structure is -
    <?xml version="1.0"?>
    <ns0:MT_SRC xmlns:ns0="http://www.sap-press.com/xi/training/00">
    <organization>
    <employee>
    <firstname>Jack</firstname>
    <lastname>Rose</lastname>
    </employee>
    <employee>
    <firstname>Paul</firstname>
    <lastname>McNealy</lastname>
    </employee>
    <employee>
    <firstname>Vaibhav</firstname>
    <lastname>Pandey</lastname>
    </employee>
    </organization>
    </ns0:MT_SRC>
    Example of target structure is -
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_TRGT xmlns:ns0="http://www.sap-press.com/xi/training/00"><Organization><employee><name>JackRose</name></employee><employee><name>PaulMcNealy</name></employee><employee><name>VaibhavPandey</name></employee></Organization></ns0:MT_TRGT>
    and here's the code I'm using
    package com.mapping;
    import java.io.*;
    import java.util.Map;
    import java.util.HashMap;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.MappingTrace;
    import com.sap.aii.mapping.api.StreamTransformation;
    public class JavaMap implements StreamTransformation{
         private Map param = null;
            private MappingTrace  trace = null;
            public void setParameter (Map param) {
                this.param = param;
                if (param == null) {
                    this.param = new HashMap();
            public void execute(InputStream in, OutputStream out) {
                   OutputStreamWriter buf_writer = new OutputStreamWriter(out);        
                   InputStreamReader buf_reader = new InputStreamReader(in);
                   String mat = new String();
                   String extmat = new String();
                   try {
                        buf_writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>" ,0,56);
                        buf_writer.write("<ns0:MT_TRGT xmlns:ns0=\"http://www.sap-press.com/xi/training/00\">");
                        buf_writer.write("<Organization>",0,20);
                        buf_writer.flush();
                  } catch(IOException e){};
                  try {
                       DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();          
                       factory.setValidating(false);          
                       DocumentBuilder builder = factory.newDocumentBuilder();          
                       Document doc = builder.parse(in);
                        String fname = null;
                        String lname = null;
                        doc.getDocumentElement().normalize();
                        //System.out.println("Root element " + doc.getDocumentElement().getNodeName());
                        NodeList nodeLst = doc.getElementsByTagName("employee");
                        //System.out.println("Information of all employees");
                        for (int s = 0; s < nodeLst.getLength(); s++) {
                        Node fstNode = nodeLst.item(s);
                        if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
                             buf_writer.write("<employee>");     
                        Element fstElmnt = (Element) fstNode;
                        NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("firstname");
                        Element fstNmElmnt = (Element) fstNmElmntLst.item(0);
                        NodeList fstNm = fstNmElmnt.getChildNodes();
                        //System.out.println("First Name : " + ((Node) fstNm.item(0)).getNodeValue());
                        fname = fstNm.item(0).getNodeValue();
                        NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("lastname");
                        Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
                        NodeList lstNm = lstNmElmnt.getChildNodes();
                        //System.out.println("Last Name : " + ((Node) lstNm.item(0)).getNodeValue());
                        lname = lstNm.item(0).getNodeValue();
                        buf_writer.write("<name>"fname" "lname"</name>");
                        buf_writer.write("</employee>");
                        buf_writer.write("</Organization>");
                        buf_writer.write("</ns0:MT_TRGT>");
                        TransformerFactory tFactory = TransformerFactory.newInstance();
                     Transformer transformer = tFactory.newTransformer();
                     transformer.setOutputProperty("indent", "yes");
                     DOMSource source = new DOMSource(doc);
                     StreamResult result = new StreamResult(out);
                     transformer.transform(source, result);
                        } catch (Exception e) {
                        e.printStackTrace();
    However, when I'm testing my Interface mapping, I'm getting the following error -
    Call method execute of the application Java mapping com.mapping.JavaMap
    Error during appliction Java mapping com/mapping/JavaMap
    java.lang.StringIndexOutOfBoundsException at java.lang.String.getChars(String.java:672)
    Could anyone please help me out with this?
    Thanks and Regards,
    Shiladitya

    HI,
    It looks to be that your JavaMap class have one field whihc will be not getting the proper value as input thus its creating the array Index out of bound exception.
    Please can you verify if you have assigned the proper String size for all the fields.
    Or probably you are getting the blank value which have created the execption.
    Also can you narrow down and let me know about the line String.getChars(String.java:672)
    Here you have used the try and catch option but may be the exact line no. can give better idea about the problem.
    Thanks
    swarup

  • Problems with Java Mapping in Bpm

    Hello to All.
    I have a simple scenario...
    1) Receiver ( XML1)
    2) Transformation
    3) Sender (XML3)
    I have 3 variables.  
    Variable 1  XML1
    Variable 2  XML2
    Variable 3  XML3
    In my transformation have two source.. an XML and XML2 and my mapping program is java mapping.
    The java mapping modify the XML1 according the XML2 and transform in XML3.
    When I run BPM . I have problem , because the flow stop in transformation.

    Yes I have tested. But I found the solution.. The java mapping generate a header like <xsi : Message1></>... <xsi : Message2> </>
    Thanks.

  • 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.

  • Problem by adding attachments in Java Mapping

    Hi,
    we have to add some attachments in Java Mapping.
    So we are using the Java Mapping API.
    But it doesn't work correctly.
    We got the following error in sxmb_moni:
    Attribute Manifest ExampleAttachment is initial
    So we checked what happened in the Manifest and in the SAP SOAP Envelope and we see that there is an inconsistence.
    In the SAP Manifest we find the following entries:
    <SAP:Manifest xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:wsu="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="wsuid-manifest-5CABE13F5C59AB7FE10000000A1551F7">
         <SAP:Payload xlink:href="cid:payload-79a6e3c088db11dfa4dd0017a477c1e8<at>sap.com">
              <SAP:Name>MainDocument</SAP:Name>
              <SAP:Description/>
              <SAP:Type>Application</SAP:Type>
         </SAP:Payload>
         <SAP:Payload xlink:href="ExampleAttachment">
              <SAP:Name>ExampleAttachment</SAP:Name>
              <SAP:Description/>
              <SAP:Type>ApplicationAttachment</SAP:Type>
         </SAP:Payload>
    </SAP:Manifest>
    For us it seems the entry for our ExampleAttachment is wrong. I think there must be a real content id for the attachment like the cid for the MainDocument. In the SOAP Envelope you can find the following entry for the attachment:
    content-type:text/plain
    content-length:45
    content-id:payload-79a6e3c088db11dfa4dd0017a477c1e8<at>sap.com
    This is an example for an attachment!
    --SAP_0017A477C1EC1DEFA3D200A5CB55CE04_END--
    So here you can see a real content ID, but you can't find it in the Manifest.
    So do we anything wrong in our source code or is it a bug of the SAP API?
    Do you have any ideas?
    Here the Java Mapping we're using for adding an attachment (as a test):
    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.Reader;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.DynamicConfiguration;
    import com.sap.aii.mapping.api.DynamicConfigurationKey;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    import com.sap.aii.mapping.api.Attachment;
    public class SUSAttaHandler extends AbstractTransformation {
         private static final DynamicConfigurationKey KEY_FILENAME    = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
         // Transform Method
         public void transform(TransformationInput in, TransformationOutput out)
                   throws StreamTransformationException {
              // An info message is added to trace
              getTrace().addWarning("JAVA Mapping AttaHandler called!");
              // Input payload
              String inData = convertStreamToString(in.getInputPayload().getInputStream());
              // dynamic configuration
              DynamicConfiguration conf = in.getDynamicConfiguration();
              String fileName          = conf.get(KEY_FILENAME);
              getTrace().addWarning("AttaHandler: FileName = " + fileName);
              String text = new String("This is an example for an attachment!");
              Attachment atta = out.getOutputAttachments().create("ExampleAttachment", "text/plain", text.getBytes());
              out.getOutputAttachments().setAttachment(atta);
              String outData = inData;
              try {
                   out.getOutputPayload().getOutputStream().write(outData.getBytes("UTF-8"));
              catch(Exception exception1) { }
         // convert Stream to String
         public String convertStreamToString(InputStream in){
              StringBuffer sb = new StringBuffer();
              try {
                   InputStreamReader isr = new InputStreamReader(in);
                   Reader reader = new BufferedReader(isr);
                   int ch;
                   while((ch = in.read()) > -1) {
                        sb.append((char)ch);}
                        reader.close();
              } catch(Exception exception) { }
              return sb.toString();
    Thanks for your help,
    Thorsten

    Hi,
    we created an OSS ticket for this problem and SAP created a SAP note.
    Here the number of the note: 0001501345
    I hope this will help you.
    Thorsten

  • In Java Mapping Whether to SAX or DOM ?

    While implementing Java Mapping which of the following SAX , DOM parsers  is the most efficient way to implement it.
    I mean considering the voulume of data in the XML format is large which  usage will give me most  optimal performance .
    It would be nice if someone could give a sample most  optimal java code using JAXP where  input stream is read  and after  processing written to  output stream.
    regards
    Nilesh Taunk.

    Hi Nilesh,
    >>>While implementing Java Mapping which of the following SAX , DOM parsers is the most efficient way to implement it.
    there's no one good answer fot this question
    except: it depends:)
    SAX and DOM are a little different parsers
    so it depends what will your java mapping
    have to do: if it will change the
    structure or maybe it will only change a few tags,
    or maybe it will do something else
    have a look at the page below to read a simple
    comparision between SAX and DOM
    http://www.scit.wlv.ac.uk/~jphb/cp2101/week4/XML_Parsing.html
    or this thread:
    http://www.biglist.com/lists/xsl-list/archives/200301/msg01318.html
    they will give you some idea which one to choose
    depending on your requirements
    BTW
    remember use java mappings only
    if you cannot use graphical mapping (very easy debugging)
    and if your document cannot be parsed (maybe huge documents)
    with XSLT which is supported by many graphilal tools
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

  • JAVA mapping using SAX parser adds extra tags

    Hi,
      We are using  java mapping using a SAX parser.It works well in standalone application ie it parses correctly and gets our desired xml structure and the xml is well formed too but when we import it in XI as a jar file it does not throw any errors but adds extra start tags, as a result the output xml is not well formed.XI is adding extra start tags.
    If any one else has faced a similar situation please help.
    Regards,
    Anirban.

    Hi Roberto,
    Thank you for the response.
    As I said, it doesnt throw any error. It is working perfectly in standalone application. But when we deploy it to XI Server, it is not forming the well formed XML. We too are puzzled by this situation.
    Okay, i will explain my scenario here.
    The following is my input XML to the java pgm..
    <Header>
    </Header>
    <Body>
    </Body>
    <SubBody1>
    </SubBody1>
    <SubBody2>
    </SubBody2>
    <SubBody3>
    </SubBody3>
    <SubBody4>
    </SubBody4>
    <Trail>
    </Trail>
    The desired output is
    <Header>
      <Body>
         <NameChanged1>
            <NameChanged2>
    <SubBody3>
    <SubBody4>
    </SubBody4>
    </SubBody3>
    </NameChanged2>
    </NameChanged1>
    <Trail>
    </Trail>
    Just look at the SubBody2 and SubBody1 node, its tag name has been changed in the output XML. Thats y i have decided to use java mapping instead of message mapping.
    I have developed the code for everything, i.e for changing the tag name and for forming the nested xml and it is working fine as a standalone application. But while deploying it to XI, the output is not well formed. I dont know the reason for it. Even I have checked the cardinality of the output Data types, that I have created. Its perfectly okay with all.
    Any Ideas???
    Regards,
    Anirban

  • XI java mapping using SAX

    Hi,
    im using java mapping for complex IDOC structure. If I run program localy, it works great, but when XI runs mapping, I have problems with xml file, some elements are not there ?! I don't know why it happens.....i said that i'm using complex logic, and therefore I'm using complex IF statments to produce segment in IDOC. I have noticed that there is a problem, because when I switch off IF, everything is fine???? any idea??
    thx mario

    Hi,
    Do you have nested 'if' statements?  Is it possible you could be experiencing a "dangling else" problem?
    http://www.dai-arc.polito.it/dai-arc/manual/tools/jcat/main/node101.html

Maybe you are looking for

  • "Happy Birthday" calendar event virus?

    I have an event called "Happy Birthday" on my actual birthday in September on my iPad calendar. Somehow, it's growing. I know have 25 events on my calendar on the same day and a new one appears each time I check. It says its from "Contacts" with an e

  • NW2004sSP7_Preview J2EE Server error

    Hi, I am not able to start the J2ee server after install. Here is the trace file from the server. trc file: "C:\usr\sap\J2E\JC01\work\dev_server0", trc level: 1, release: "700" node name   : ID14203250 pid         : 5668 system name : J2E system nr. 

  • Installing photoshop elements 10 on a windows vista machine

    Should I install photoshop elements 10 on a windows vista machine in the "Program Files" or "Program Files (x86)" folder.  I am running 64 bit on the machine.  Thanks for the help

  • Chapter Not Working

    I have created a menu with a single play button that starts a movie lasting 1 hour and 15 minutes.  I've inserted 5 chapter points in the movie.  This is something I have done many times in the past and never had a problem, until now. When previewing

  • HT1212 i do not remember my passcode

    Hello kindly help me to unlock my iPhone