Java Mapping to override namespace prefix (startPrefixMapping)

Does anyone have an example of using a Java Map to override the default XI namespace prefix. The method startPrefixMapping looks like it might do the job but I can't find any example of how this works.

You can use the Anonymizer Module Processor.
In your adapter, go to the "Modules" tab, than insert a new entry <b>before</b> the default adapter module processor. Enter module name <b>localejbs/AF_Modules/XMLAnonymizerBean</b> and <b>Local Enterprise Bean</b> type. In the parameters tab, enter parameter <b>anonymizer.acceptNamespaces</b> and parameter value <b>'<namespace>' <prefix></b>. You can enter more than one namespace, like in <b>'<namespace1>' <prefix1> '<namespace2>' <prefix2></b>.
Note that your namespace must be inside apostrophes by default. If instead you want to use quotes to define the namespace, you must use another parameter before the one above: parameter name <b>anonymizer.quote</b> and in the value enter a single quote <b>"</b>.
To define an empty prefix (meaning, that namespace is the default namespace) use '' (two apostrophes) instead of <prefix> (or "" (two quotes), if you have used anonymizer.quote).
Check SAP Note 880173 for more information.
Regards,
Henrique.

Similar Messages

  • XSLT mapping to remove namespace prefix

    Hi experts,
    I have one requrement where I need to remove the prefix ns0 from the xml (given below) getting generated in message mapping.
    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns0:ExecuteRequest xmlns:ns0="http://test/">
    <ns0:_sRequestXML><inteflow>body</inteflow></ns0:_sRequestXML></ns0:ExecuteRequest></soap:Body></soap:Envelope>
    I am usimg the below xslt and it is now adding one ns0 prefix in the tag <inteflow>.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <ExecuteRequest xmlns="http://test/">
    <_sRequestXML>
    <inteflow>
    <xsl:copy-of select="//inteflow"/>
    </inteflow>
    </_sRequestXML>
    </ExecuteRequest>
    </xsl:template>
    </xsl:stylesheet>
    Result after using xslt.
    <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ExecuteRequest xmlns="http://test/"><_sRequestXML>
    <inteflow xmlns:ns0="http://decisionintellect.com/inteport/"></inteflow></_sRequestXML></ExecuteRequest></soap:Body></soap:Envelope>
    Can you please help. What is wrong in the xslt and how I can get the desired result.
    Thanks & Regards,
    Pratyus Ganguly
    <?

    Hi Pratyus
    XMLAnonymizerBean works fine when I try it with your payload. Here is the config, basically I included the namespace for everything except the ns0.
    Parameter Name
    Parameter Value
    anonymizer.acceptNamespaces
    http://www.w3.org/2001/XMLSchema xsd http://www.w3.org/2001/XMLSchema-instance xsi http://schemas.xmlsoap.org/soap/envelope/ soap
    Before
    After
    Rgds
    Eng Swee

  • ParserException: XMLParser: Prefix 'c' is not mapped to a namespace

    Hello and thanks in advance for any help. I am trying to deploy a war (that worked with Tomcat 4.1) on SAP Web Application Server.
    In this war I have a JSP that says
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:jsp="http://java.sun.com/products/JSP/Page"
           xmlns:c="http://java.sun.com/jstl/core"
           xmlns:trx="http://www.highdeal.com/taglib">
      <jsp:directive.include file="jspf/doctype.jspf"/>
      <html>
        <jsp:directive.include file="jspf/Imports.jspf"/>
        <jsp:include page="include/Variables.jsp" flush="true" />
        <head>
          <title><c:out value="$"/></title>
          <jsp:directive.include file="jspf/Style.jspf"/>
        </head>
    In my web.xml, I have:
    <taglib>
    <taglib-uri>http://www.highdeal.com/taglib</taglib-uri>
    <taglib-location>WEB-INF/trx.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
    <taglib-location>WEB-INF/c.tld</taglib-location>
    </taglib>
    I am becoming crazy because of the exception I keep having in the logfile:
    #1.5#0013CEDA9E4F00380000000800000DDC00040F1A970A7F6A#1142506784439#com.sap.engine.services.servlets_jsp.server.jsp.JSPParser#sap.com/csrui.war#com.sap.engine.services.servlets_jsp.server.jsp.JSPParser#Guest#2####f9b076e0b4db11da96df0013ceda9e4f#SAPEngine_Application_Thread[impl:3]_7##0#0#Error#1#/System/Server#Plain###Runtime error in compiling of the JSP file <D:/usr/sap/J2E/JC00/j2ee/cluster/server0/apps/sap.com/csrui.war/servlet_jsp/csrui/root/WEB-INF/jsp/Logon.jsp> ! The error is: TagLibValidator returns error(s) for taglib ( http://java.sun.com/jstl/core ):
         com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: Prefix 'c' is not mapped to a namespace(:main:, row:818, col:1)(:main:, row=818, col=1) -> com.sap.engine.lib.xml.parser.ParserException: XMLParser: Prefix 'c' is not mapped to a namespace(:main:, row:818, col:1)
    #1.5#0013CEDA9E4F00380000000900000DDC00040F1A970A834A#1142506784439#com.sap.engine.services.servlets_jsp.Deploy#sap.com/csrui.war#com.sap.engine.services.servlets_jsp.Deploy#Guest#2####f9b076e0b4db11da96df0013ceda9e4f#SAPEngine_Application_Thread[impl:3]_7##0#0#Error##Plain###Runtime error in compiling of the JSP file <D:/usr/sap/J2E/JC00/j2ee/cluster/server0/apps/sap.com/csrui.war/servlet_jsp/csrui/root/WEB-INF/jsp/Logon.jsp> ! The error is: com.sap.engine.services.servlets_jsp.server.jsp.exceptions.ParseException: TagLibValidator returns error(s) for taglib ( http://java.sun.com/jstl/core ):
         com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: Prefix 'c' is not mapped to a namespace(:main:, row:818, col:1)(:main:, row=818, col=1) -> com.sap.engine.lib.xml.parser.ParserException: XMLParser: Prefix 'c' is not mapped to a namespace(:main:, row:818, col:1)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.validate(JSPParser.java:243)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.initParser(JSPParser.java:348)
         at com.sap.engine.services.servlets_jsp.server.jsp.JSPParser.parse(JSPParser.java:105)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.getClassName(JSPServlet.java:238)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.compileAndGetClassName(JSPServlet.java:428)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:169)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:290)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:346)
         at com.highdeal.wui.base.WForwardFactory.forwardPage(WForwardFactory.java:89)
         at com.highdeal.wui.base.WForwardFactory.forward(WForwardFactory.java:128)
         at com.highdeal.wui.base.HighdealSession.forward(HighdealSession.java:245)
         at com.highdeal.wui.base.ControllerServlet.performAction(ControllerServlet.java:568)
         at com.highdeal.wui.base.ControllerServlet.perform(ControllerServlet.java:913)
         at com.highdeal.wui.base.ControllerServlet.doPost(ControllerServlet.java:482)
         at com.highdeal.wui.base.ControllerServlet.doGet(ControllerServlet.java:476)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         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:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)
    What am I doing wrong here??
    Tangi

    Hi Tangi,
    A small mistake in your web.xml
    <taglib>
    <taglib-uri>http://www.highdeal.com/taglib</taglib-uri>
    <taglib-location><b>/</b>WEB-INF/trx.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
    <taglib-location><b>/</b>WEB-INF/c.tld</taglib-location>
    </taglib>
    You have missed a / before WEB-INF.
    Also, the order of entries in web.xml matters. Refer <a href="http://www.pchighway.com/helpdesk/index.php?page=index_v2&id=1694&c=135">here</a> for more info about JSTL.
    Hope this solve your problem.
    Regards,
    Uma

  • Prefix is not mapped to a namespace

    Hello All:
      I have a incoming XML with ns0 name space. I had to anticipate it so I put in the declaration xmlns:ns0 = "http://XXXX-myxml.com"  in the xsl:stylesheet.
      But when I run this scenario. It throw exception at run time. With below error message
    XCE001 Nested exception: com.sap.b1i.bizprocessor.BizProcException: BPE001 Nested exception: com.sap.b1i.utilities.UtilException: UTE001 Nested exception: javax.xml.transform.TransformerConfigurationException: Could not load stylesheet.com.sap.engine.lib.xml.util.NestedException: Could not load XSLWhen. Stylesheet: null, element: <xsl:when xmlns:xsl="http://www.w3.org/1999/XSL/Transform" test="$msg/ns0:PriceList">PriceList</xsl:when> -> com.sap.engine.lib.xml.util.NestedException: Prefix not mapped: ns0 -> java.lang.Exception: XMLParser: Prefix 'ns0' is not mapped to a namespace
    Thank You!

    Hi Bo,
    please define all namespaces in the INBOUND Definition (INBOUND-CHANNEL) of your scenario.
    This is the only way to replicate the namespaces automatically into all xslt files.
    Manual changes within your xslt files will be overwritten.
    Best regards
    Bastian
    P.S.: please reactivate your scenario after changing the INBOUND definition.

  • Java mapping & namespace issue

    Hello,
    I am doing a java mapping from a flat file to an IDOC. After the document is mapped succesfully I call an RFC via the Adapter. When monitoring the adapter I get the error:
    com.sap.aii.af.rfc.RfcAdapterException: failed to read funtionname from XML document: missing namespace declara
    so I added the namespace reference to my java mapping to look like this :
    <ns0:IDOC_INBOUND_ASYNCHRONOUS xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
    But when I test my java mapping in the builder (interface mapping) the namespace xmlns="urn:sap-com:document:sap:rfc:functions" is added to my above ns0:IDOC_INBOUND_ASYNCHRONOUS tag. The consequence is that while mapping in the integration engine the "ns0" prefix is then removed and I get the error:
    Delivery of the message to the application using connection AFW failed, due to: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: functiontemplate from repository was.
    Any help or sample code resolving the namespace issue is welcome.
    Frank

    Hi Frank,
    I am getting the same error message. You fixed yours. Can you help me with mine. The error message is
      " Delivery of the message to the application using connection AFW failed, due to: error while processing message to remote system:com.sap.aii.af.rfc.core.client.RfcClientException: functiontemplate from repository was ."
    I am trying to send data to SAP SRM4.0 from SAP R/3 using SAP XI. XI content is delivered by SAP.
    The message is sent from R/3 to XI successfully and the XML monitor does not show any errors in XI . But the messages does not show up in SRM.
    Thanks
    Kishore.

  • Namespace missing in java mapping DOM ?

    Hi,
    I am creating java mapping using DOM, but why i cannot create a namespace using this code ?
    Document targetDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
    Node docRoot = targetDoc.appendChild(targetDoc.createElementNS("urn:sap-com:atp:ABC40:base", "ns1:Vendor_SQL"));
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
    // create source and result wrappers and perform transformation
    DOMSource source = new DOMSource(targetDoc);
    StreamResult result = new StreamResult(outputStream);  
    transformer.transform(source, result);
    expected result in xml :
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Vendor_SQL xmlns:ns0="urn:sap-com:atp:ABC40:base">
    </ns0:Vendor_SQL>
    result :
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Vendor_SQL>
    </ns0:Vendor_SQL>
    Please advise whether i was missing any other required step ?
    Note : testing using NWDS 7.0 SP 17
    Thank You and Best Regards
    Fernand

    Hi Lesmana,
    Can you change the second line in the code like below and give a try::
    Node docRoot = targetDoc.appendChild(targetDoc.createElementNS("ns1:urn:sap-com:atp:ABC40:base", "ns1:Vendor_SQL"));
    Regards,
    ---Saish

  • ParserException: XMLParser: Prefix 'xsl' is not mapped to a namespace

    Hi
    although I do not think this is an XI problem.. I hope that somebody with more XSLT experience that I might be able to help.
    I have a rather simple XSLT that is used to convert an EXCEL XML document into another XML format.  The XSL that I have worked when I tested it via standalone SAXON or MSXML transformation.
    But using the SAP product it gives me the error Prefix 'xsl' is not mapped to a namespace.
    Here is the top part of the XSL
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:sp="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:of="urn:schemas-microsoft-com:office:office">
    <xsl:output method = "xml"  version="1.0" encoding="ISO-8859-1" omit-xml-declaration="no" standalone="no" indent="yes"  />
       <xsl:template match="/">
         <dvabatch>
              <xsl:apply-templates select = "//of:DocumentProperties" />
         </dvabatch>
       </xsl:template>
    .... and so on.....
    and the top part of the XML source
    <?xml version="1.0"?>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:html="http://www.w3.org/TR/REC-html40">
    <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
      <Author>Peter Munt</Author>
      <LastAuthor>muntp</LastAuthor>
      <LastPrinted>2006-01-30T23:53:27Z</LastPrinted>
      <Created>2003-02-06T18:19:41Z</Created>
      <LastSaved>2006-03-01T03:59:11Z</LastSaved>
      <Company>DVA</Company>
      <Version>10.2625</Version>
    </DocumentProperties>
    <CustomDocum  ....
    ..... and so on .....

    Hi Peter,
    just for clarification:
    You zipped the XSL File and imported it into a Mapping Archive, then assigned the XSL Mapping to an interface mapping and receive the error in the Message Monitoring?
    Is that the case?
    regards,
    Peter

  • Mapping Question p3: .. etc.. namespace prefixes

    Does anyone know why xi uses namespace prefixes like p3: p2: etc..?  I am trying to map based on an rfc as the target and a message from a wsdl as the source.  I can not test the map because it expects the test file ( from our partner ) to have all these P3:'s in it and it doesn't.  Here is a snippet of what is happening at translation ....
    <p3:Execute2 xmlns:p3="http://www.some/namespace/">
    <p3:transaction-limit type="Amount"><p3:value>99999999999</p3:value></p3:transaction-limit><p3:transaction-limit type="Number"><p3:value> 9999</p3:value></p3:transaction-limit></p3:daily-transaction-limits><p3:single-transaction-limits></p3:single-transaction-limits><p3:monthly-transaction-limits></p3:monthly-transaction-limits></p3:authorization-control><p3:request-type>Activate</p3:request-type>
    Message was edited by: Andrew Alpaugh

    Hi Andrew,
    the question is a little bit unclear to me. When I get you right, you have a WSDL that describes a message you get from a partner. You use this WSDL to define a Message Mapping. The Message Mapping does not work as expected. The fragment you have posted is probably what the Message Mapping seems to expect (according to the test panel). But the message you get from your partner looks different (it does not have all these prefixes).
    I suppose that the schema contained in the WSDL (more precisely in the types-section) states that all elements have to be namespace-qualified (this could e.g. be done by having an elementFormDefault="qualified" in the schema). Thus, if the elements are unqualified in the message you get from your partner it simply means that the partner does not stick to the WSDL.
    If this does not help you, I would have to see the WSDL and an example message that failed to work.
    Note, however that there are different ways to express namespaces. If the document sent by your partner looks as follows:
    <Execute2 xmlns="http://www.some/namespace/">
    <transaction-limit type="Amount">...
    it is logically equivalent to the one you posted, and the Message Mapping will treat them identical.
    Greetings
              Stephan

  • How to replace namespace tag with new value using -JAVA MAPPING

    Hi Guys,
    I need to replace namespace Tag in Target xml with a new value.
    For Eg: My namespace Tag is - <ns0:TestHeader xmlns:ns0="http://0020.TestHeader.SS.com">
    I want My target xml to have value- <ns0:TestHeader>
    How can i achieve it using JAVA mapping?
    Can you provide me the code to do so.

    Sarjana,
    Not well-formed XML is only possible by Java Mapping. Please use below replace logic in Java map.
    inputContent.replaceAll("<ns0:TestHeader xmlns:ns0=\"http://0020.TestHeader.SS.com\">", "<ns0:TestHeader>");
    Link1, Link2.

  • PI Java Mapping NullPointerException

    Hi Gurus,
    I'm having some troubles doing the mapping through java mapping in PI.
    I've done the java class in the SAP NWDS and imported it on PI through the ESR.
    Now i'm trying to test through the SOAP and i've found the following error in the "Communication Channel Monitor":
    500   Internal Server Error  SAP NetWeaver Application Server/Java AS 
    java.lang.NullPointerException: while trying to invoke the method com.sap.aii.af.sdk.xi.lang.Binary.getBytes() of a null object returned from com.sap.aii.af.sdk.xi.mo.xmb.XMBPayload.getContent()
    And the following error in the SXMB_MONI:
    <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="INTERNAL">CLIENT_SEND_FAILED</SAP:Code>
      <SAP:P1>500</SAP:P1>
      <SAP:P2>Internal Server Error</SAP:P2>
      <SAP:P3>(See attachment HTMLError for details)</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>Error while sending by HTTP (error code: 500 , error text: Internal Server Error) (See attachment HTMLError for details)</SAP:Stack>
    I've developed the code below:
    public class PI_Mapping_IF extends AbstractTransformation {
      public void transform(TransformationInput in, TransformationOutput out)    throws StreamTransformationException  {  
      this.execute(in.getInputPayload().getInputStream(), out.getOutputPayload().getOutputStream()); 
      public void execute(InputStream in, OutputStream out)  throws StreamTransformationException { 
      try  
      // Inicio do java mapping
      getTrace().addInfo("JAVA Mapping Iniciado"); //Log para o PI/XI
      // Declarações referentes ao XML de entrada
      DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
      DocumentBuilder db = dbf.newDocumentBuilder();
      Document xml_in = db.parse(in);
      // Declarações referentes ao XML de saída
      Document xml_out = db.newDocument();
      TransformerFactory transformerFactory = TransformerFactory.newInstance();
      Transformer transformer = transformerFactory.newTransformer();
      // Remove o standalone
      xml_in.setXmlStandalone(true);
      // Declara a estrutura que a RFC irá receber
      Element root = xml_out.createElement("ns1:ZFSD_VMOI_UPLOAD_CF_PG");
      root.setAttribute("xmlns:ns1","urn:sap-com:document:sap:rfc:functions");
      xml_out.appendChild(root);
      Element i_cenario = xml_out.createElement("I_CENARIO");
      root.appendChild(i_cenario);
      Element t_input = xml_out.createElement("T_INPUT");
      root.appendChild(t_input);
      Element item = xml_out.createElement("ITEM");
      t_input.appendChild(item);
      Element STRING = xml_out.createElement("STRING");
      item.appendChild(STRING);
      Element t_return = xml_out.createElement("T_RETURN");
      root.appendChild(t_return);
      Element item_r = xml_out.createElement("ITEM");
      t_return.appendChild(item_r);
      Element message = xml_out.createElement("MESSAGE");
      item_r.appendChild(message);
      // Verifica se existe algum filho no nó
      NodeList nodos = xml_in.getChildNodes(); 
      if (nodos.item(0) != null)
      getTrace().addInfo("O nó(XML) possui filhos"); //Log para o PI/XI
      // Declaração de variáveis
      String ident = ""; // <Ident>
      String buyer = ""; // <BuyerLineItemNum>
      String result = ""; // <Ident>;<BuyerLineItemNum>;<Date>;<QuantityValue>
      // Inicia a extração das informações do XML
      try{
      // Recupera o nó ShipToParty
      NodeList nodeShip = xml_in.getElementsByTagName("ns0:ShipToParty");
      Node node = nodeShip.item(0);
      Element elemXML = (Element) node;
      try{
      NodeList nodeIdent = elemXML.getElementsByTagName("ns0:Ident");
      Element nameElement = (Element) nodeIdent.item(0);
      nodeIdent = nameElement.getChildNodes();
      // Recupera o valor da chave <Ident>
      ident = PI_Mapping_IF.VerifyNull(((Node) nodeIdent.item(0)).getNodeValue());
      }catch(Exception e){
      result += "0.0;";
      // Recupera o nó ListOfMaterialGroupedPlanningDetail
      NodeList nodeBuyer  = xml_in.getElementsByTagName("ns0:MaterialGroupedPlanningDetail");
      for (int i = 0; i < nodeBuyer.getLength(); i++) {
      node = nodeBuyer.item(i);
      elemXML = (Element) node;
      try{
      // Preenche a chave BuyerLineItemNum
      NodeList nodeBuyerLine = elemXML.getElementsByTagName("ns0:BuyerLineItemNum");
      Element elemBuyerLine = (Element) nodeBuyerLine.item(0);
      nodeBuyerLine = elemBuyerLine.getChildNodes();
      buyer = PI_Mapping_IF.VerifyNull(((Node) nodeBuyerLine.item(0)).getNodeValue());
      }catch(Exception e){
      buyer += "0;";
      result = ident+";"+buyer+";";
      Node nodeDt_Qnt = nodeBuyer.item(i);
      Element elemDt_Qnt = (Element)nodeDt_Qnt;
      NodeList nodeValores = elemDt_Qnt.getElementsByTagName("ns0:ScheduleDetail");
      for (int j = 0; j < nodeValores.getLength(); j++) {
      node = nodeValores.item(j);
      elemXML = (Element) node;
      try{
      // Preenche a chave Date
      NodeList modelExtra = elemXML.getElementsByTagName("ns0:Date");
      Element extraElement = (Element) modelExtra.item(0);
      modelExtra = extraElement.getChildNodes();
      result += PI_Mapping_IF.VerifyNull(((Node) modelExtra.item(0)).getNodeValue())+";";
      }catch(Exception e){
      result += "//;";
      try {
      // Preenche a chave QuantityValue
      NodeList modelURL = elemXML.getElementsByTagName("ns0:QuantityValue");
      Element urlElement = (Element) modelURL.item(0);
      modelURL = urlElement.getChildNodes();
      result += PI_Mapping_IF.VerifyNull(((Node) modelURL.item(0)).getNodeValue())+";";
      } catch (Exception e) {
      result += "0.0;";
      // Marca o final do registro
      result += "||";
      // Preenche os nós itens
      Text srcxml = xml_out.createTextNode(result);
      STRING.appendChild(srcxml);
      result = "";
      buyer = "";
      }catch(Exception e){
      // Remove o standalone
      xml_out.setXmlStandalone(true);
      // Preenche o Cenario
      Text cenario = xml_out.createTextNode("P&G");
      i_cenario.appendChild(cenario);
      // Preenche mensagem de retorno
      Text msgxml = xml_out.createTextNode("XML lido com sucesso!");
      message.appendChild(msgxml);
      // Escreve a saida do XML            
      transformer.transform(new DOMSource(xml_out), new StreamResult(out));
      getTrace().addInfo("Fim da execução do Java Mapping");
      } catch (ParserConfigurationException e) {
      getTrace().addWarning(e.getMessage());
      throw new StreamTransformationException("Can not create DocumentBuilder.", e);
      } catch (SAXException e) {
      e.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      } catch (TransformerConfigurationException e) {
      e.printStackTrace();
      } catch (TransformerException e) {
      e.printStackTrace();
    Am i doing anything wrong in the code? Where can this nullpointerexception be triggered?
    Thanks.

    These three xml are the same:
    <?xml version="1.0"?><a:xml xmlns:a="urn:123">root</a:xml>
    <?xml version="1.0"?><xml xmlns="urn:123">root</xml>
    <?xml version="1.0"?><ns0:xml xmlns:ns0="urn:123">root</ns0:xml>
    But your code will work only with last one, because it doesn't bound namespace to prefix ns0.

  • How to remove namespace prefix from target payload when using HTTP in PI7.0

    Hi,
    i have a requirement to remove namespace prefix from target payload when receiver receives the payload by an HTTP request.
    i am not able to use XML Anonymizer Bean as in HTTP channel its not possiile.
    Target structure after mapping now is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns3:Order xmlns:ns3="urn:xxx-com:pi:project">
    fields
    </ns3:Order>
    i need the target structure after mapping should look like:
    <?xml version="1.0" encoding="UTF-8"?>
    <Order xmlns:="urn:xxx-com:pi:project">
    fields
    <Order>
    i removed namespace from source and target Message Type of message mapping but still getting "ns3" prefix. My requirement is to just have this ns3 removed.
    Please reply if anyone has solved this problem before.
    Thanks

    Hi ,
    >>>i removed namespace from source and target Message Type of message mapping but still getting "ns3" prefix. My requirement is to just have this ns3 removed.
    Which process you've used for removing namespace...java/xslt mapping. In case of java mapping plese remove ns3 while creating the target element. Please go through the below blog it may help you.
    Quick Tips: Dealing with Namespaces in XI/PI
    Regards,
    Priyanka

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

  • XML Namespace Prefix required

    Hello,
    our partner uses Biztalk to receive our SOAP calls. They tell us that each attribute and element needs to have the namespace prefix otherwise Biztalk cannot read it.
    We are sending:
    SAP XI Output
    <?xml version="1.0" encoding="utf-8" ?>
    <ns11:Receive_SAP xmlns:ns11="http://zzz.com/it/mmpur/sem/xi">
      <part>
       <xform id="SWI:PLG:Order Header - SAP">
        <model>A</model>
       </xform>
      </part>
    </ns11:Receive_SAP>
    They want:
    Biztalk Requirement:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns11:Receive_SAP xmlns:ns11="http://zzz.com/it/mmpur/sem/xi">
      <ns11:part>
       <ns11:xform id="SWI:PLG:Order Header - SAP">
        <ns11:model>A</ns11:model>
       </ns11:xform>
      </ns11:part>
    </ns11:Receive_SAP>
    Can that be done with the XI 3.0 Graphical mapping or do I have to use JAVA Mapping or XSLT?
    Did anyone come accros this before with Biztalk Server and it there an option to avoid it on the Biztalk Server side?
    Thanks
    Stefan

    Hi Stefan,
    Where did you obtain the schema (XSD) from? 
    Most likely, the elements you are using are local elements and do not belong to the target namespace, but to an unnamed global namespace.  This is a typical characteristic of schema's defined by SAP.
    The short answer/solution is probably putting elementFormDefault="true" in the header of your target schema. That should do the trick.
    Kind regards, Guy Crets

  • Remove ns1: namespace prefix in HTTP adapter

    Dear Experts,
    I'm facing the following issue, using the plain HTTP receiver adapter:
    when I'm sending out my XML message, the "usual" ns1: namespace prefixes are added to the message.
    It goes out like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:INQUIRY xmlns:ns1="urn:namespace.com:retail">
    <SESSION_ID>0000157338</SESSION_ID>
    <POSITION>
    <item>
    </ns1:INQUIRY>
    And it should be like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <INQUIRY xmlns:ns1="urn:namespace.com:retail">
    <SESSION_ID>0000157338</SESSION_ID>
    <POSITION>
    <item>
    </INQUIRY>
    In previous forum-threads, there are several proposed solutions:
    1. using the XMLAnonymizerBean
    It doesn't work here, because in plain HTTP I cannot call up any module processor (it doesn't go through the AE)
    2. using XSLT to remove the complete namespace
    It is not good, because I have to keep the namesapce, but without the ns1 prefixes
    So, the question to you is: how to delete only(!) the ns1 prefixes, keeping the original namespace in the message.
    Any comments are welcome!
    Best regards,
    Andras Kovacs

    Dear Stefan,
    thank you for the helpful response!
    Some thougths about the proposed solutions:
    - Create external wsdl/xsd without prefix: I tried thois point with Sytlus-Studio, but here I can only delete/remove the whole namespace. If I leave the namespace in the message, the prefix will be added again as well.
    - Java mapping: the general question here, how to remove something from the payload? Should we use string manipulation (like Alessandro mentions it in his blog: /people/alessandro.guarneri/blog/2006/10/13/get-rid-of-recordset-node ) or should we use here SAX ? Is there any "standard" solution for this?
    - Use SOAP adapter instead of plain HTTP: it worked quite well and I could remove the prefix with the XMLAnonymizer Bean!
    Here you mentioned that it can called up in "no SOAP mode". Do you mean here check in the "don't use SOAP envelope" checkbox or is it something more?
    Thank you in advance for the useful responses!
    Best regards,
    Andras

  • Java Mapping using DOM

    Hi All,
    I need Java mapping help. I will get incomming payload as following
    <orders>
    <matnr>123</matnr>
    <qty>10</qty>
    </orders>
    i need to change the above payload as follows
    <ns0:orders>
    <ns0:matnr>123</ns0:matnr>
    <ns0:qty>10</ns0:qty>
    </ns0:orders>
    Please help me how to achieve this using Java mapping.
    Regards
    Vijay

    Hi,
    Dom will be quite expensive for this type of requirement since you will have to go to each element and then append the namespace.
    I suggest you use SAX parser which is more  efficient for such requirement.
    The code is given below you can modify it according to your requirement.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    public class SAXDemo extends DefaultHandler{
         public StringBuffer sb = new StringBuffer();
         public String PREFIX = "ns0:";
         int count = 1;
         public static void main(String[] args)
              SAXDemo demo= new SAXDemo();
              demo.saxdemo();
              System.out.println();
         public void saxdemo()
              InputStream in;
              try
                   in = new FileInputStream(new File("Input.xml"));
                   SAXParserFactory factory = SAXParserFactory.newInstance();
                   factory.setNamespaceAware(true);
                   factory.setValidating(false);
                   SAXParser saxParser = factory.newSAXParser();
                   * Parse the content of the given {@link java.io.InputStream}
                   * instance as XML using the specified
                   * {@link org.xml.sax.helpers.DefaultHandler}.
                   * @param inputstream InputStream containing the content to be parsed.
                   * @param cobject The SAX DefaultHandler to use.
                   * @exception IOException If any IO errors occur.
                   * @exception IllegalArgumentException If the given InputStream is null.
                   * @exception SAXException If the underlying parser throws a
                   * SAXException while parsing.               
                   saxParser.parse(in, this);
                   System.out.println(sb.toString());
              catch (FactoryConfigurationError e)
                   e.printStackTrace();
              catch (ParserConfigurationException e)
                   e.printStackTrace();
              catch (SAXException e)
                   e.printStackTrace();
              catch (IOException e)
                   e.printStackTrace();
         public void startDocument()throws SAXException
         public void endDocument()throws SAXException
         public void startElement(String namespaceURI, String name, String qName, Attributes attrs)
         throws SAXException
              if(count == 1)
                   sb.append("<"+PREFIX+qName+" "+PREFIX+"xmlns="+namespaceURI+">");
              else
                   sb.append("<"+name+">");
              count ++;
         public void endElement(String uri, String name, String qName) throws SAXException
              sb.append("</"+qName+">");
         public void characters(char buf[], int offset, int len)
         throws SAXException
              String s = new String(buf, offset, len);
              buf  = null;
              sb.append(s.trim());
                   s = null;
    Regards
    Fariha

Maybe you are looking for

  • HT201361 Is it possible to save the screenshot files to a different folder than desktop. How can I change the folder?

    Is it possible to save the screenshot files to a different folder than desktop (that is the default). How can I change the destination folder? Thank you, Sal

  • FSCM-COL: Cleared invoices in Payments Tab

    Hi all, We have a requirment here where our client wants to check all the invoices, even the cleared oneu2019s in the Process Receivables view. Now, in the u201CInvoicesu201D tab we only have the open items and in the u201CPaymentsu201D tab we only h

  • Problem with parallels desktop.....

    hi. im not sure if this has been said or answered before but i have installed the trial version of parallels desktop for mac. i don't really know how to use it and i just really wanted to see what it does. unfortunately....i dont need it. but, now i

  • How to mount and get file on my external drive

    I have a external hdd drive(size 500GB) using FAT32 system. There are two partition actually. But I can only mount and read the one (disk1s2). (disk1s3) had existing file I want to read but I can't mount. How can I do? see below /dev/disk1    #:     

  • S_p00_07000134

    Hi Friends, I would be getting a file from transaction S_p00_07000134 in R/3. This file is would be used as a input file to my XI scenario. Now the problem is when I execute the transaction S_p00_07000134 it will ask for the file path to save it(It w