Java messgae mapping help pls

hi forum, in message mapping, when i see the XML of the target or source structure i can see the prefix of the qualifiedNameas as ns1 or ns0,
eg., <ns0:MT_sdptest_JMapTest2>
what does that signify....
coz when i made a java mapping programm and tried to test it as an independant program outside XI, taking one XML file as input and one XML file as output, in the code for creating the output structure, i hade created the root element(for the output structure) as
Element rootNode = documentOut.createElementNS("http://zpoc.com.test/sdptest","ns0:MT_sdptest_JMapTest2");
the XML produced gives error as:
"Reference to undeclared namespace prefix: 'ns0'. Error processing resource "
pls help me.....coz i want to intergrate it in a Interface mapping in a scenario

You can remove the namespace prefixes using an XSLT mapping if they are causing problems with applications outside of XI.
Try the following code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.arconw.com/XI/XSLT_Library/XmlNamespacePrefixRemoval"
version="1.0">
<xsl:output method = "xml" />
<xsl:template match="/">
<xsl:apply-templates select="*" mode="remprefix"/>
</xsl:template>
<xsl:template match="*" mode="remprefix">
<xsl:variable name="newname" select="local-name(.)"/>
<xsl:element name="{$newname}" namespace ="{namespace-uri()}">
<xsl:apply-templates mode="copyall" select="@*|comment()|processing-instruction()|text()"/>
<xsl:apply-templates select="*" mode="remprefix"/>
</xsl:element>
</xsl:template>
<xsl:template mode="copyall" match="@*|comment()|processing-instruction()|text()">
<xsl:copy>
<xsl:apply-templates mode="copyall" select="@*|comment()|processing-instruction()|text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Please assign forum points if you find this useful ***
Thanks,
Paul D.
Message was edited by:
        Paul Digance

Similar Messages

  • Servlet java.util.Map Help

    It's been a while since I have written any code and I am having an issue getting back into it.
    I am currently working on creating servlet to pass info from all my forms to my business logic. However, I am having an issue with getting the data. This may be a topic for a different forum, but I figured I would ask here.
    I tested out the servlet with the getParameter() method, and I can get the values. However, when I try to use the java.util.Map, I get blank values.
    I think the issue may be that I forgot how to use the Map object. Here is my code:
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet CalCartController</title>");
    out.println("</head>");
    out.println("<body>");
    for (int i = 0; i < formParamsMap.size(); i++) {
    Map.Entry entry = (Map.Entry) keyValuePairs.next();
    String key = (String)entry.getKey();
    String value = (String)entry.getValue();
    out.println(value);
    out.println("<h1>Servlet CalCartController </h1>");
    out.println("</body>");
    out.println("</html>");

    hacktorious wrote:
    OK, so if I replace the loop with the following:
    String firstName = (String)formParamsMap.get("firstName");
    out.println(firstName);
    this gives a blank result.If firstName is an actual parameter, it's probably throwing an exception, and you're swallowing it or otherwise not seeing it. I would expect a ClassCastException if the map contained "firstName".

  • Java mapping help pls

    hi all,
    I've a source structure like this below in PI.
    <MAT>
    <doc type>pdf</doc type
    <subnumber>1234</subnumber>
    <id>45ABC<id>
    <matno>ABCD</matno>
    <filename>transaction1.pdf</filename>
    </MAT>
    target structure would be the same but one more field <filecontent> which is bytearray content such as content=[101, 115, 116, 13, 10, 84, 101, 115, 116, 13, 10, 84, 101, 115, 116, 13, 10, 84, 101, 115, 116, 13, 10, 13, 10, 84, 101, 115, 116, 13, 10, 84, 101, 115, 116, 13, 10, 13, 10, 84, 101, 115, 116, 13, 10, 13, 10, 84, 101, 115, 116, 13, 10, 84, 101, 115, 116, 13, 10]
    <MAT>
    <doc type>pdf</doc type
    <subnumber>1234</subnumber>
    <id>45ABC<id>
    <matno>ABCD</matno>
    <filename>transaction1.pdf</filename>
    <filecontent>bytearraycontent</filecontent
    </MAT>
    And target is HTTP post for posting the above attribute names and values in the body of HTML
    I am writing a java mapping program because I have to read the <filename> tag value from the incoming xml and read the file from PI server location and convert the file content to bytearray and also to map it to target structure for HTTP post. I am requesting help from java experts here in modifying the program according to this requirement. pls help
    package com.usahealth.mapping;
    import java.io.InputStream;
    import java.net.URL;
    import java.net.URLConnection;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class ReadAttrMap extends AbstractTransformation {
      @Override
      public void transform(TransformationInput in, TransformationOutput out)
      throws StreamTransformationException {
      AbstractTrace trace = null;
      try {
      // Initialize Trace
      trace = getTrace();
      // Get Input Message as DOM
      DocumentBuilderFactory docBFactory = DocumentBuilderFactory
      .newInstance();
      docBFactory.setNamespaceAware(true);
      DocumentBuilder docBuilder = docBFactory.newDocumentBuilder();
      Document inDoc = docBuilder.parse(in.getInputPayload()
      .getInputStream());
      inDoc.getDocumentElement().normalize();
      // Read from PayLoad  - here is where I need help to read the filename - convert it to byte array and read other xml tag values and pass  to target structure for HTTP post. I am using HTTP receiver adapter for posting
      } catch (Exception e) {
      trace.addInfo(e.getMessage());
      throw new StreamTransformationException("Mapping Exception: "
      + e.getMessage(), e);
    thx
    mike

    Indrajit, thx again
    So I believe, the java mapping has to be changed to not pass MAT for create element
    // building the target structure   Element target = newdoc.createElement("MAT");  - I have to remove this
    newdoc.appendChild(target);  - have to remove this.   Element doctype = newdoc.createElement(root.getChildNodes().item(1)  will be changed to item(0)
      .getNodeName()); 
    And also to add the logic for  [    ]
    String data = "["; 
    if (fileArray != null) { 
    for (int i = 0; i < fileArray.length; i++) { 
    if data = "[";
    data = data + fileArray[i]; 
    else
    if (i < fileArray.length - 1) { 
    data = data + ","; 
    endif.
    data = data + "]";
    is this right?
    thx indrajit
    -mike

  • Java Mapping. Pls help

    Hi,
    Question:
    1. What is java mapping.
    2. How I use java mapping/UDF in message mapping
        for my below scenario
    In my Request XML there are 2 fields.
    In my Response XML there are 2 fields.
    Field 1 of Request XML needs to be mapped directly to
    Field 1 of Response XML.
    Field 2 needs to be passed as paramter to java class and
    java class will be give response that will be mapped to
    Field 2 of Response XML.
    Pls advice . It is urgent.
    Regards

    Hi Rac,
    Java mapping can be used when you have complex mapping structures.
    We can do most of the times for our requirements through Graphical mapping.
    When the structures are very complex to build you can go for SAX (Simple API for XML) or DOM (Document Object Model) parsers.
    Message mapping internally generates DOM parser.
    Java Mapping in XI
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=java+mapping&adv=false&sortby=cm_rnd_rankvalue#
    SAP Network Blog: Implementing a Java Mapping in SAP PI
    /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
    Java Mapping (SAP Library - Partner Connectivity Kit)
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    SAP Network Blog: XI Java Mapping Helper (DOM)
    /people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    SAP Network Blog: Testing and Debugging Java Mapping
    /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    Binary Conversion in XI - Java Mapping - Code Gallery - Wiki
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/binary%2bconversion%2bin%2bxi%2b-%2bjava%2bmapping
    SAP Network Blog: "JAVA MAPPING", an alternate way of reading a CSV file
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    Thanks,
    Satya Kumar.
    Reward points if it is useful..

  • Java.lang.NoSuchMethod: main - Help pls

    This is the code i got off a book but it seems like it's not working. I got an error which says 'java.lang.NoSuchMethod: main' Help pls...
    import java.io.*;
    import java.util.*;
    class PostfixInterpreter {
         private String postfixString, outputString;
    private boolean isOperator(char c) {
         return (c == '+' || c == '-' || c == '*' || c == '/' || c == '^' );
    private boolean isSpace(char c) {
         return (c == ' ');
    }//end isSpace
    public void interpretPostfix() {
         Stack evalStack= new Stack();
         double leftOperand, rightOperand;
         char c;
         StringTokenizer parser = new StringTokenizer(postfixString,"+-*/^ ", true);
         while (parser.hasMoreTokens()){
              String token = parser.nextToken();
              c = token.charAt(0);
              if ((token.length() == 1) && isOperator(c)) {
                   rightOperand = ((Double)evalStack.pop()).doubleValue();
                   leftOperand = ((Double)evalStack.pop()).doubleValue();
                   switch (c) {
                        case'+': evalStack.push(new Double(leftOperand+rightOperand));
                                       break;
                        case'-': evalStack.push(new Double(leftOperand-rightOperand));
                                       break;
                        case'*': evalStack.push(new Double(leftOperand*rightOperand));
                                       break;
                        case'/': evalStack.push(new Double(leftOperand/rightOperand));
                                       break;
                        case'^': evalStack.push(new Double(Math.exp(Math.log(leftOperand)*rightOperand)));
                                       break;
                        default:
                                       break;
                   }//end of switch
              }else if((token.length() == 1)&& isSpace(c)){
              }else {
                   evalStack.push(Double.valueOf(token));
              }//end if
         }//end while
    // remove final result from stack and output it
    output("value of postfix expression = " + evalStack.pop());
    }//end interpretPostfix
    private void output(String input){
         postfixString = input;
         }//end setInput
    public String getOutput(){
         return outputString;
    }//end getOutput
    }//end class PostfixInterpreter
    /*Stack class*/
    class Stack {
         private int count;
         private int capacity;
         private int capacityIncrement;
         private Object[] itemArray;
    //the following defines a no-arg constrcutor for Stack objects
    public Stack() {
         count = 0;
         capacity = 100;
         capacityIncrement = 5;
         itemArray = new Object[capacity];
         public boolean empty() {
              return (count ==0);
         public void push(Object X) {
              //if the itemArray does not have enough capacity
              //expend the itemArray by the capacity increment
                   if(count == capacity) {
                        capacity += capacityIncrement;
                        Object[] tempArray = new Object[capacity];
                        for (int i=0; i<count;i++){
                             tempArray[i] = itemArray;
                   itemArray=tempArray;
              //insert the new item X at the end of the current item sequence
              //and increase the stack's count by one
                   itemArray[count++]=X;
    public Object pop() {
         if(count==0){
              return null;
         }else{
              return itemArray[--count];
    }//end of pop()
    public Object peek() {
         if (count == 0){
              return null;
         }else{
              return itemArray[count-1];
    }//end peek()

    First, when posting code in the future, use the code /code tags. Just highlight the code and click the code. button.
    The error probably occurred when you tried to launch the class as an application by entering "java PostfixInterpreter" The java application launcher looks for a method in the PostfixInterpreter class whose signature is exactly public static void main(String[] args)(except 'args' can be any legal variable name). Since your PostfixInterpreter class doesn't have this method, you get the error. If you want this class to run, you have to include the method and code inside the method that runs the application.

  • Java2D graphics -GIS (Help pls)

    Hey!...
    My Applet is basically split into two parts....a JTree on the left and a text area on the right...i have two arrays...x3Points and y3Points that contain the map co-ordinates that are retrieved from the server side. They contain data like following for example.....
    x3points (-119.169)
    y3points (45.7601)
    x3points (-119.259)
    y3points (45.8506)
    I am trying to display these points in the text area using the following code syntax....but nothing show up :(...can neone help pls!
    for(int i=0;i<x3Points.length-1;i++)
    g2.draw(new Line2D.Double(x3Points,y3Points[i],x3Points[i+1],y3Points[i+1]));
    Thank You...An

    if your using Swing than use JPanel and turn of opaque or make your one JComponent
    if your using awt to build your application then use canvas.
    if you need more information look in the swing part of the forum or look at java doc and tutor. I suggest to you to d/l the doc/tut of your specific j2se.

  • Java xslt mapping

    hi,
      could any one please forward me java and xslt mapping step by step screen shots.
    I would be thankful to you ,if you do this.
    with regards,
    [email protected]

    Java Mapping
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    /people/rahul.nawale2/blog/2006/07/18/java-mapping-an-alternate-way-of-reading-a-csv-file
    XSLT Mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15
    /people/sriram.vasudevan3/blog/2005/11/21/effective-xsl-for-multimapping-getting-source-filenames-in-legacy-legacy-scenarios
    Regards,
    Prateek

  • Message mapping help

    Hi,
    I am doing graphical message mapping.
    Source structure looks like
    <BAC>
    <IXYZ>
    <DEF>
    <PQR>
    All are 0.. 1.
    Target field is item which is also 0.. unbounded.
    If ABC is not blank, assign to target  field item[0] as 1st occurance.
    If DEF is not blank, assign the same to item[1] field as 2nd occurance and so on.
    Can this be done using message mapping without udf or java? If not, pls let me know other ways.
    Thanks
    anand

    Hi,
    <ABC> -> lenth Function (TEXT)-> Greate Then -> 0 (using the IF Condition)
      <ABC> -> CopyValue(docuble click and give the index 0) -> to Target
    <DEF> -> lenth Function (TEXT)-> Greate Then -> 0 (using the IF Condition)
      <DEF> -> CopyValue(docuble click and give the index 1) -> to Target
    Regards,
    Venu.

  • JAVA Sax mapping replaces &_amp; with & causing mapping to fail

    Hi all,
    I have the following mapping scenario:
    Source XML -> Java Sax Mapping -> Graphical Mapping -> Target structure
    The source XML is valid and caters for special characters like & which appear as &_amp; in the XML (ignore the underscore _ without it the editor strips the amp;, isn't that ironic!).
    The second step of the interface mapping, which is the graphical map, is failing. It seems that the Java Sax mapping is replacing &_amp; with & in the XML, which is then causing the graphical map to fail as it cannot handle the special character &.
    Is there anyway I can prevent the Java Sax mapping from changing &amp; to &
    Or is the only solution for me to write extra code in the Java map to convert & back to &_amp; before passing to the second mapping step????
    Any help appreciated.
    Che
    Edited by: Che Eky on Feb 18, 2009 11:05 PM

    Hi..
    Use this in your source xml file for '&' ->"&_amp;" remove the underscore
    Regards..
    Krishna..
    Edited by: PrasannaKrishna Mynam on Feb 19, 2009 2:20 PM
    Edited by: PrasannaKrishna Mynam on Feb 19, 2009 2:20 PM

  • Problems with Java DOM Mapping

    Hi Experts,
    as part of my diploma-thesis I have to write a java DOM-Mapping, which mapps the following incoming message:
    <mt_MappingOUT>
    <set>
    <set_Element_01>...</set_Element_01>
    <set_Element_02>... </set_Element_02>
    <set_Element_03>... </set_Element_02>
    <set_Element_10>  </set_Element_10>
    </set>
    </mt_MappingOUT>
    to the following outgoinig message:
    <mt_MappingIN>
    <TABLE>
    <item>
    <item_FIELD_01>  </item_FIELD_01>
    <item_FIELD_10>  <item_FIELD_10>
    <i/tem>
    </TABLE>
    </mt_MappingIN>
    I am not a very experienced Java-Developer. You can see my code down there, which I tried to implement according to some bloggs; unfortunately the result is not what I want to have
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    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 org.w3c.dom.Text;
    import org.xml.sax.SAXException;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class DOMMAPPING implements StreamTransformation{
         public static void main(String[] args) throws Exception
              try
                   FileInputStream fin =
                        new FileInputStream("C:/mt_MappingOut.xml");
                   FileOutputStream fout =
                        new FileOutputStream("C:/target.xml");
                   DOMMAPPING mapping = new DOMMAPPING();
                   mapping.execute(fin, fout);
              catch (Exception e)          {
                   e.printStackTrace();
    public void setParameter (Map param) {}
    public void execute (InputStream in, OutputStream out)
         throws com.sap.aii.mapping.api.StreamTransformationException {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
              Document documentIn = null;
              DocumentBuilder builder = null;
              try {
                        builder = factory.newDocumentBuilder();
                   } catch (ParserConfigurationException e1) {
                        e1.printStackTrace();
              try {
                   Element itemNode = null;
                   NodeList[] list_f=new NodeList[10];
                   Element[] field=new Element[10];
                   documentIn = builder.parse(in);
                   Document documentOut = builder.newDocument();
                   Element rootNode = documentOut.createElementNS("urn:agrp:xi:geissseb","ns0:mt_MappingIn");
                   documentOut.appendChild(rootNode);
                   Element tableNode = documentOut.createElement("TABLE");
                   rootNode.appendChild(tableNode);
                   NodeList list_Set=documentIn.getElementsByTagName("set");
                   System.out.println(list_Set.getLength());
                   for(int j=1;j<10;j++){
                        list_f[j-1]=documentIn.getElementsByTagName("set_ELEMENT_01"+j);
                list_f[9]=documentIn.getElementsByTagName("set_ELEMENT_10");
                   //NodeList list_f01=documentIn.getElementsByTagName("f01");
                   for (int i=0;i<list_Set.getLength();i++)
                        itemNode=documentOut.createElement("item");
                        tableNode.appendChild(itemNode);
                        for(int k=0; k<10;k++){
                             Node f=list_f[k].item(i);
                             f=f.getFirstChild();
                             String str_f=f.getNodeValue();
                             Text text_f=documentOut.createTextNode(str_f);
                             field[k]=documentOut.createElement("item_FIELD_"(k1));
                             field[k].appendChild(text_f);
                             itemNode.appendChild(field[k]);
                   TransformerFactory tf = TransformerFactory.newInstance();
                   Transformer transform = tf.newTransformer();
                   transform.transform(new DOMSource(documentOut), new StreamResult(out));
                   } catch (SAXException e2) {
                        e2.printStackTrace();
                   } catch (IOException e2) {
                        e2.printStackTrace();
                   }catch (Throwable t) { throw new StreamTransformationException("error", t); }
    Unfortunately there seems to be at least one error in there because the result I get is just the following:
      <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    - <ns0:mt_MappingIn xmlns:ns0="urn:agrp:xi:geissseb">
      <TABLE />
      </ns0:mt_MappingIn>
    Below you will find my source message:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <xsd:schema targetNamespace="urn:agrp:xi:geissseb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="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">a7a28830bebf11dc81aa001a4b0af224</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="f01" 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>
    When I had problems withe Java SAX Mapping, I got great hints in the forum. So I hope you can help me out again...
    Cheers Sebastian

    Here you go.
    Code
    package com.sap.test;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.apache.crimson.tree.TextNode;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Text;
    import org.xml.sax.SAXException;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class DomTest {
         Document documentOut = null;
         public static void main(String[] args) throws Exception
         try
         FileInputStream fin =      new FileInputStream("test.xml");
         FileOutputStream fout = new FileOutputStream("test_out.xml");
         DomTest mapping = new DomTest();
         mapping.execute(fin, fout);
         catch (Exception e) {
         e.printStackTrace();
         public void setParameter (Map param) {}
         public void execute (InputStream in, OutputStream out)
         throws com.sap.aii.mapping.api.StreamTransformationException {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         Document documentIn = null;
         DocumentBuilder builder = null;
         try {
         builder = factory.newDocumentBuilder();
         } catch (ParserConfigurationException e1) {
         e1.printStackTrace();
         try {
         Element itemNode = null;
         //NodeList[] list_f=new NodeList10;
         //Element[] field=new Element10;
         documentIn = builder.parse(in);
         documentOut = builder.newDocument();
         Element rootNode = documentOut.createElementNS("urn:agrp:xi:geissseb","ns0:mt_MappingIn");
         rootNode.setAttribute("xmlns:ns0", "urn:agrp:xi:geissseb");
         documentOut.appendChild(rootNode);
         Element tableNode = documentOut.createElement("TABLE");
         rootNode.appendChild(tableNode);
         NodeList list_Set = documentIn.getElementsByTagName("set");
         System.out.println(list_Set.getLength());
         for(int j = 0 ; j < list_Set.getLength() ;j++){
              Element setNode = (Element)list_Set.item(j);
              NodeList children = setNode.getChildNodes();
              for(int index = 0; index < children.getLength(); index++)
                   Node child = children.item(index);
                   if (child instanceof Element) {
                        Element element = (Element) child;
                        if(element.getNodeName().startsWith("set_ELEMENT"))
                             createItemFeildNode(tableNode,element);
         //list_f[9]=documentIn.getElementsByTagName("set_ELEMENT_10");
    //     NodeList list_f01=documentIn.getElementsByTagName("f01");
         /*for (int i=0;i<list_Set.getLength();i++)
         itemNode=documentOut.createElement("item");
         tableNode.appendChild(itemNode);
         for(int k=0; k<10;k++){
         Node f=list_f[k].item(i);
         f=f.getFirstChild();
         String str_f=f.getNodeValue();
         Text text_f=documentOut.createTextNode(str_f);
         field[k]=documentOut.createElement("item_FIELD_"(k1));
         field[k].appendChild(text_f);
         itemNode.appendChild(field[k]);
         TransformerFactory tf = TransformerFactory.newInstance();
         Transformer transform = tf.newTransformer();
         transform.transform(new DOMSource(documentOut), new StreamResult(out));
         transform.transform(new DOMSource(documentOut), new StreamResult(System.out));
         } catch (SAXException e2) {
         e2.printStackTrace();
         } catch (IOException e2) {
         e2.printStackTrace();
         }catch (Throwable t) { throw new StreamTransformationException("error", t); }
         private void createItemFeildNode(Element root, Element element) {
              String inName = element.getNodeName();
              int temp = inName.lastIndexOf('_');
              if (temp == -1)
                   return;
              String index = inName.substring(temp+1);
              String nodeName = "Item_FIELD_" + index;
              String nodeVal = element.getFirstChild().getNodeValue();
              Element newElement = documentOut.createElement(nodeName);
              Text txtNode = documentOut.createTextNode(nodeVal);
              newElement.appendChild(txtNode);
              root.appendChild(newElement);          
    Input
    <?xml version="1.0" encoding="UTF-8" ?>
    <mt_MappingOut xmlns="urn:agrp:xi:geissseb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:agrp:xi:geissseb file:/D:/Eclipse/workspace/SDN/test.xsd">
    <set xmlns="">
      <set_ELEMENT_01>E1</set_ELEMENT_01>
      <set_ELEMENT_02>E2</set_ELEMENT_02>
      <set_ELEMENT_03>E3</set_ELEMENT_03>
      <set_ELEMENT_04>E4</set_ELEMENT_04>
      <set_ELEMENT_05>E5</set_ELEMENT_05>
      <set_ELEMENT_06>E6</set_ELEMENT_06>
      <set_ELEMENT_07>E7</set_ELEMENT_07>
      <set_ELEMENT_08>E8</set_ELEMENT_08>
      <set_ELEMENT_09>E9</set_ELEMENT_09>
      <set_ELEMENT_10>E10</set_ELEMENT_10>
      </set>
      </mt_MappingOut>
    Output
    <?xml version="1.0" encoding="UTF-8" ?>
    <ns0:mt_MappingIn xmlns:ns0="urn:agrp:xi:geissseb">
    <TABLE>
      <Item_FIELD_01>E1</Item_FIELD_01>
      <Item_FIELD_02>E2</Item_FIELD_02>
      <Item_FIELD_03>E3</Item_FIELD_03>
      <Item_FIELD_04>E4</Item_FIELD_04>
      <Item_FIELD_05>E5</Item_FIELD_05>
      <Item_FIELD_06>E6</Item_FIELD_06>
      <Item_FIELD_07>E7</Item_FIELD_07>
      <Item_FIELD_08>E8</Item_FIELD_08>
      <Item_FIELD_09>E9</Item_FIELD_09>
      <Item_FIELD_10>E10</Item_FIELD_10>
      </TABLE>
      </ns0:mt_MappingIn>

  • Unable to install Sun Java System MAPI Service Providers

    I tried to install the outlook connector for Outlook 2003. I've got the following error message. It said that Unable to install Sun Java System MAPI Service Providers. I am using Windows 2000 SP3 platform
    --- 2005/06/22 11:41 ---
    11:41:26 [5365] Outlook version is 11.0.6359.0.
    11:41:26 ERROR: [5501] Unable to find MAPI directory.
    11:41:26 No directory "C:\Program Files\Common Files\System\MAPI\LANGID" with LANGIDs: 1033, 0, 1033, 1033, 1033, 1033.
    11:41:26 [5475] TMP directory is 'C:\DOCUME~1\admin\LOCALS~1\Temp'.
    11:41:28 [5362] Checking Windows version.
    11:41:28 [5363] Windows version is 5.0.
    11:41:28 [5364] Checking Outlook version.
    11:41:28 [5509] Checking default mail client.
    11:41:28 [5508] Default mail client is 'Microsoft Outlook'.
    11:41:28 [5178] Verifying that Outlook is not running.
    11:41:28 [5179] Trying to login to shared session.
    11:41:29 ERROR: [5501] Unable to find MAPI directory.
    11:41:29 No directory "C:\Program Files\Common Files\System\MAPI\LANGID" with LANGIDs: 1033, 0, 1033, 1033, 1033, 1033.
    11:41:29 [5366] Checking whether Sun Java System MAPI Service Providers are installed.
    11:41:29 ERROR: [5501] Unable to find MAPI directory.
    11:41:29 No directory "C:\Program Files\Common Files\System\MAPI\LANGID" with LANGIDs: 1033, 0, 1033, 1033, 1033, 1033.
    11:41:31 ERROR: [5351] Unable to install Sun Java System MAPI Service Providers.
    11:41:31 ERROR: Unable to install Sun Java System MAPI Service Providers.
    Anyone can help for this? Thanks

    I have used this method, but the dog gone service does not return a started status. It just keeps saying starting even after the service starts.
    Download sc.exe from ftp://ftp.microsoft.com/reskit/win2000/sc.zip and copy
    it to system32
    Open a command line, change to C:\Sun\AppServer\lib and run:
    C:\winnt\system32\sc.exe create SJdomain1 binPath=
    "C:\Sun\AppServer\lib\appservService.exe
    \"C:\Sun\AppServer\bin\asadmin-pause.bat start-domain domain1\"
    \"C:\Sun\AppServer\bin\asadmin-pause.bat stop-domain domain1\"" start= auto
    DisplayName= "SunJava domain1"
    1. I'm no fan of windows and I prefer Solaris or Linux
    2. Windows should have this tool as a part of the OS so I don't have to go hunt for it
    3. I guess this solution is better than no solution at all :)

  • Java.util.Map to as object

    Hi,
    I want to get java.util.Map object returned from server-side
    on the client-side. I don't know which flex data-type should I use
    for that. I tried Array but it dint help. Someone plz help...
    Thanks in advance,
    Cheree

    You can use a for-in ActionScript loop to examine any
    ActionScript Object:
    for(var i:String in someObject) {
    trace( i+" = "+someObject
    Within the loop, i assumes the name of all the public
    properties in the given object.

  • Java.util.Map type return in webservice method

    Wonder, how we can return a java.util.Map type from a webservice deployed on a
    weblogic 7.x environment..
    any input is appreciated.
    -Girish

    Thanks Michael. it helps.
    -Girish
    "Michael Wooten" <[email protected]> wrote:
    >
    Hi Girish,
    By definition, a Java object used as a input parameter (or return type)
    of a web
    service operation, must has a no-arg constructor in order for a Java-based
    Web
    Service Stack to serialize/deserialize it to/from XML. java.util.Map
    is an interface,
    so it does not meet this requirement :-)
    If your web service operation is just trying to return (or accept) a
    hash map
    of "arbitrary complex types", I recommend that you consider switching
    this to
    be an "array of arrays of specific complex types". The reason I say this
    is because,
    it allows even non-Java consumers to look at the <schema> elements in
    your web
    services' WSDL, and figure out all the possible "arbitrary complex types"
    that
    might be in this array. If you envision the consumer getting a box, where
    it can
    literally contain anything, you can probably see how much more code they
    would
    need to write, than if they knew the the box contained a box of these,
    and a box
    of these, and so on, and so on.
    Basically, all the "old school" type-safety rules still apply to web
    services
    computing. If you want web services with descent performance metrics,
    you're probably
    going to want to keep a lot of the "old school, distributed computing"
    practices
    in mind, when you design your stuff :-)
    That said, WLS 7.0 SP1 does not currently have a "built-in" HashMap codec.
    But,
    you could create one using the information at:
    http://edocs.bea.com/wls/docs70/webserv/customdata.html#1054435
    Regards,
    Mike Wooten
    "girish" <[email protected]> wrote:
    Wonder, how we can return a java.util.Map type from a webservice deployed
    on a
    weblogic 7.x environment..
    any input is appreciated.
    -Girish

  • BEA error: deleteTaskAttributes(int,java.util.Map)

    Hello,
    I have installed OIM 9100 on BEA with an Oracle Database.
    I got the following error message after starting OIM:
    <08.07.2008 11.07 Uhr CEST> <Warning> <EJB> <BEA-012034> <The Remote interface method: 'public abstract void com.thortec
    h.xl.scheduler.interfaces.SchedulerController.deleteTaskAttributes(int,java.util.Map) throws com.thortech.xl.scheduler.e
    xception.SchedulerGenericException,java.rmi.RemoteException' in EJB 'SchedulerController' contains a parameter of type:
    'java.util.Map' which is not Serializable. Though the EJB 'SchedulerController' has call-by-reference set to false, this
    parameter is not Serializable and hence will be passed by reference. A parameter can be passed using call-by-value only
    if the parameter type is Serializable.>
    Can anybody help me or tell me what it means?
    Thank you,
    Matthias

    BEA Weblogic normally throws a ton of these errors as it seems like OIM's ideas on what should be passed by reference and what should be passed by value does not play well with Weblogic.
    I have been told to ignore these warnings.
    Good luck
    /M

  • Compile error import java.util.map$entry

    Hi,
    I am trying to compile code which imports the following package
    import java.util.Map$Entry.
    The error thrown up is : cant resolve symbol Map$Entry. Why is there a $ in the package import path and is there some configuration required to compile the file.
    I am not allowed to change the code. Does anyone have an idea on how this problem can be solved.
    Thanks and regards
    Kumar Vellal

    Btw java docs for the interface are available at:
    http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.Entry.html
    Changing the import should probably help compile the code, but without changing the import .. need to check. This is just from what i remember now. Lets see if anyone else comments on this.

Maybe you are looking for