Xml payload in a single field

Hi All,
I hve a scenario like this ERP->XI->Monitoring system
In the mapping, I need to assign the outbound payload (whole xml) to a field in the target
message field since the (Target) Monitoring system wants to receive the whole xml message in single field.
How can i achieve this?
Thanks
Deno

try this.. some of the imports are not required.. however I just copied from my code..
import javax.ejb.CreateException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import com.sap.aii.af.mp.module.Module;
import com.sap.aii.af.mp.module.ModuleContext;
import com.sap.aii.af.mp.module.ModuleData;
import com.sap.aii.af.mp.module.ModuleException;
import com.sap.aii.af.ra.ms.api.Message;
import com.sap.aii.af.service.trace.Trace;
import java.util.Hashtable;
//XML Parsing and Transformation classes
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import java.io.StringWriter;
import com.sap.aii.af.ra.ms.api.XMLPayload;
import com.sun.org.apache.xml.internal.serialize.OutputFormat;
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
import javax.xml.transform.*;
import javax.xml.transform.Source;
import javax.xml.transform.Result;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;     
Object obj = null; //Handler to get principal data
          Message msg = null;// Handler to get message object
          String getXMLtoField = null;
          try {
               obj = inputModuleData.getPrincipalData();
               msg = (Message)obj;
               XMLPayload xmlpayload = msg.getDocument();
                    DocumentBuilderFactory factory;
                    factory =DocumentBuilderFactory.newInstance();
                    DocumentBuilder builder = factory.newDocumentBuilder();
                    // parse the XML Payload
                    Document document = builder.parse((InputStream)
                    xmlpayload.getInputStream());
                    OutputFormat format = new OutputFormat(document);    // Serialize DOM
                    StringWriter stringOut = new StringWriter();    // Writer will be a String
                    XMLSerializer serial = new XMLSerializer(stringOut, format);
                    serial.asDOMSerializer();                       // As a DOM Serializer
                    serial.serialize(document.getDocumentElement());
                    String FileContent = stringOut.toString();
          return getXMLtoField;

Similar Messages

  • Payload as a single Field

    how we can treat full file (Full payload ) as in single field.
    While file picking from sender end and keep the  full content as a payload in single field at source side?

    Hi,
    A bit confused with your question, but here are the two things which might help
    1) sending whole source payload into single field in target structure, you can do this by mapping the headersegment to the target field and select RETURN AS XML on right click. there is one blog on this with screen shots if you want to take a look.
    2) Taking whole payload from a single source field, You can do this by writing an UDF to extract the XML payload file and placing it before the MM in OP.
    Thanks...
    Karna....

  • Malformed XML payload on RFC sender scenario

    Hi all,
    I'm trying to send data from RFC to XI but I got follow error in SXMB_MONI:
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <!--  Request Message Mapping  -->
    <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30"
    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_mm_ZFI_RFC_CADASTRO_FORNECEDOR_To_~</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping
    com/sap/xi/tf/_mm_ZFI_RFC_CADASTRO_FORNECEDOR_To_~: Fatal Error: com.sap.engine.lib.xml.parser.Parser~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    When open XML payload the structure and fields are ok but data on these fields is not, some data from one field is concatenate on another field and other case data is in different field. For example on field KUNNR, data sent by RFC on R/3 is '1000000386' But on PI the XML looks like that:
    <?xml version="1.0" encoding="UTF-8" ?>
    <rfc:ZFI_RFC_CADASTRO_FORNECEDOR xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
    <T_LFA1>
      <item>
        <LIFNR>0000386</LIFNR>
    And in some fields that expect telephone number, on XML is like that:
    <TELFX>        & #00;& #00;& #00;& #00;& #00;& #00;& #00;& #12;</TELFX>
    (I HAVE TO INSERT SPACE BETWEEN  & and #00; )
    These codes generate the error com.sap.engine.lib.xml.parser.Parser~ on mapping program.
    I've tried to re-import RFC and full cache refresh but I think that error is on JCO on java stack when converting RFC call to XML. I've looked for some RFC Adapter and JCO configuration on Visual Administrator but everything looks ok.
    My system is:
    SAP PI 7.0 SP13
    SAP ECC 6.0
    Any idea how to solve this issue?
    Thanks!
    Edited by: Daniel Torres on Nov 5, 2008 2:12 PM

    Hi,
    As you can see mapping is because of Mapping , Exception During Execute come because of mapping error. So if you doing some graphical mapping there as you said you are concatenating some values passed from SAP R/3 in mapping , check it. Rather you can also check your mapping is right ot wrong using Test tab in mapping editor. also you can use Interface mapping for testing your whole scenario, i will prefer Interface Mapping thing to test my scenario as it will tell you if your requeswt mapping is correct or response message is correct.
    Lets check there and you will see exact problem of mapping.
    Regards
    Aashish Sinha

  • Enhancement Fields missing in the Inbound XML payload

    We are using XI3.0. We need to send some Purchase Order data from R/3 to SRM(SUS), in addition to what is available in the standard content. We have created the required datatype enhnacement. we have mapped these additional fields in the message mapping to their respective sources. We have also generated and activated the ABAP proxies on the SUS side. However at runtime whenever a PO is created, none of the additional fields are available in the inbound XML payload.
    Can some one help me to know what could be wrong ?
    Thanking You
    Regards
    Vinay Rane

    Hi Vinay,
    You can try one of the following options:
    1) Clear/reload XI cache using trx SXI_CACHE, after that try to test again and check whether you are getting the correct fields.
    2) Are you using the RFC adapter? if you do; then try to restart it. This adapter also caches a lot of meta data and information during runtime.
    3) Last but not least; (You probably know this better than me , but just in case...) If you had previously generated the proxy classes, and after that you did some changes in the repository then you certainly will need to regenerate those proxy classes.
    Cheers,
    R.

  • Multivalue checkbox in single field of datascheme of XML form

    Hello everyone,
    is there a way to provide the user a chance to select multiple values via checkboxes in an XML-form and write the values in a single field of the datascheme?
    Currently only the first of the selected values ends up in the proper field, although several checkboxex are attached/connected.
    Any ideas?
    THX-Henning

    I found another alternative solution.
    Regarding to how to display the multivalue properties with the multi-valu check box in "Details":
    1) Go to CM -> Global Services -> Property Metadata -> Properties
    2) Go to the property that you want to display multivalue, for my case- "NewsType", set the "Property Renderer" parameter to "allowedvale_multivalued" (for sure you have to define the allowed values)
    3) Go and check in "Details", it should show the multi-value property in check box group. Then you can "tick" and "untick" to change the values.
    Kent

  • How to prevent the logging of a single field in XI ?

    Hi Guys,
    we have developed the interfaces for payment card services using the Enterprise services and the major problem what we are facing is to prevent the logging of the 3 digit security code in XI.
    According to the payment card industry standards you should not store it as well as you should not encrypt this 3 digit CVV code.
    Is there any way we can prevent the logging of this single field in XI ?
    Is it possible if we develop our own custom adapters then we can acheive this ? Do we have full control over the DB in the custom adapters?
    any help or suggestions or other alternatives would be really appreciated. I want to hear some solution from the experts.
    Thanks in advance,
    Srini

    Hi Beena,
    You can encrypt the credit card no and SSN and that should not be a problem, but you should not store or encrypt the CVV no.
    as i said we have our own tools many customers are using with respect to RFCs where you can encrypt and decrypt the card numbers and also not storing the values of CVV.
    The above scenario works fine with no issues and it is according to the PCI standards. If you use PI 7.1 and use adaptive controlling the values are stored at a single place ie you can acheive single persistance and even this will not be our solution.
    Advanced Adapter Engine Configuration in PI 7.1
    with the single persistsnce, if there is a adapter module or custom adapter which takes the payload and prevents the stroage of the value of a single field then it would be our solution.
    Thanks,
    Srini
    Edited by: Srinivas Reddy on Aug 20, 2008 7:42 PM
    Edited by: Srinivas Reddy on Aug 20, 2008 7:57 PM

  • Displaying data from a list into a single field with comma separated values

    Hi,
    I have a requirement to change a report with an XML structure (simplified version) as below
    <Protocol>
    <ProtocolNumber>100</ProtocolNumber>
    <SiteName>Baxter Building</SiteName>
    <ListOfActivity>
    <Activity>
    <Description>Communication Memo Description.</Description>
    <Name>James</Name>
    </Activity>
    <Activity>
    <Description>Visit 4</Description>
    <Name>James</Name>
    </Activity>
    <ListOfActivity/>
    </Protocol>
    On the report I need to display all the 'Names' for each of the Child (Activities) in a single field at the Parent (Protocol) level, with each Name separated by a comma.
    How do I go about getting this to work?
    Thanks

    Take a look at this: http://blogs.oracle.com/xmlpublisher/entry/inline_grouping
    You could do this (ofcourse, you will need to add extra logic to ensure that there is no comma added after the last name..)
    <?for-each@inlines:Name?><?.?><?', '?><?end for-each?>
    Thanks,
    Bipuser

  • Xml payload related problem

    Hi ALL
    Currently I am doing a scenario in which i m encrypting the incoming xml payload(field by field) in java mapping and then decrypting it with in the adapter module.Now problem that i m facing is that after encryption if i get some special characters, the resulting xml payload becomes invalid and will not be parsed.

    hi,
    Try to put it into CDATA.
    <script>
    <b><![CDATA[</b>!@!#!@#!@#!@$@#$<b>]]></b>
    </script>
    regards,
    Wojciech
    Message was edited by: Wojciech Gasiorowski

  • Multiples payloads in a single message

    Hi everybody,
    I have a scenario where I will receive multiples payloads in a single message (several email attachments) and I have to call a WebService for each different payload, or email attachment in this case.
    Scenario: Mail Sender (multiples attachments/payloads) -> XI -> SOAP Receiver
    These attachments in the email are XML files with the same structure (WSDL) that  must map it to the WebService.
    I'm thinking in receive these payloads using Java Mapping to merge all these XML files in a single fat XML structure and after that use a BPM to do a Loop in order to call the WebService for each part of this fat XML. But I'm not sure if it is the best option and I don't really know how to do this BPM.
    Anyone has a suggestion how should I do this?
    Regards,
    Rogério

    You need to write an adapter module for merging all the XML attachements in to one. Then you should use 1..n mapping in the BPM for splitting them in to multiple payloads.
    BPM - Receive -> Transform (1..N) ->Block -> for each (message) ->send ->close block
    VJ

  • XML payload search in Xi messages

    Hi All,
    I need to get the XML pay load for a message which contains a specific value for a specific field. Also I need to get the XML message ID of this message. Is there any option available in Xi for this purpose?
    Thanks in advance..

    Hi,
    sure it is but you need to use trex search engine for that
    http://help.sap.com/saphelp_nw04/helpdata/en/43/6030fae92f5f87e10000000a1553f6/content.htm
    once you configure trex you will
    be able to search for XML payload from RWB
    (runtime workbench of XI)
    this is the first - fast way
    there are also some non standard ways
    but these are pretty slow and if you have many messages
    they will not be very efficient in use:
    /people/alessandro.guarneri/blog/2006/02/14/super-message-monitor-for-sap-xi
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • XML Payload extraction from XI Message

    Hi to all,
    I use the SXI_MONITOR transaction to see the XML Payload of XI Messages. In this transaction, each successfully message has a field "MainDocument" under "Response" section that contains the XML Payload of the message.
    <B>There is a function module that I can use to extract the XML from MainDocument field?</B> I've tryed to look into SXMSCLUP and SXMSCLUR abap data tables but here I founded only the SOAP Header and SOAP Body data of the message. Here I can't see the "Payloads" data, so the MainDocument tag.
    Can anyone help me?
    Thanks!

    Ciao Gabriele,
    there are differente way to do it.
    one time I got same issue and I got some answer on the community.
    Unfortunately there was no more need for it so i did not implement but
    easily speaking in all the mapping got the payload therefore u need just to create a full mapping adn to process the data u get.
    In java for example is given as input stream that u can store some where and process.
    I pasted the result below:
    IN java
    How to get the whole payload
    in abap
    /people/udo.martens/blog/2006/02/16/own-logging-of-xi-messages
    please rewars point is useful thanks.
    regards,
    Giamma

  • Non-XML payload in graphical mapping

    Experts,
    I have a scenario where I need to trigger a graphical map which eventually populates an IDoc (custom) structure but the Idoc is not being populated with any of the source field.
    My source data is a flat file.
    1. I dont want the src file content to be transformed to XML.
    2. But need to trigger the map (graphical map) to populate the constant values in IDoc.
    However, even with a src message type with a single String type element (no sub-element), the mapping is failing giving XML parsing error.
    Question is:
    1. If it is possible to call a Graphical map without the XML conversion of the source? if yes.. how?
    2. Otherwise can I use Java / ABAP mapping? because since the input parameter for IF_MAPPING~EXECUTE - source is XSTRING type. So can I pass a flat file instead?
    - Shibaji

    HI Shibaji
    1. I dont want the src file content to be transformed to XML.
    2. But need to trigger the map (graphical map) to populate the constant values in IDoc.
    XI expects some XML if it is empty also it will work but you need to send dummy XML for triggering the mapping. You can pass just a blank field as source to trigger this.
    . If it is possible to call a Graphical map without the XML conversion of the source? if yes.. how?
    IE expects XML to process so you need to send some data to execute mapping. I don't think you can avoid XML conversion.
    Otherwise can I use Java / ABAP mapping? because since the input parameter for IF_MAPPING~EXECUTE - source is XSTRING type. So can I pass a flat file instead?
    Java or ABAP mapping also require some source and target to be formed and when you can meet the requirement for triggering the mapping from Graphical. It will complicate using Java/ABAP mapping
    I think if you have a source dummy message with single field with 0..1 occurrence then it should trigger your mapping without any error
    Thanks
    Gaurav

  • XML Unbounded values into one field - Message Mapping

    Dear All,
    I am trying to convert an unbounded multifield XML structure to a 0.1 field so that the maltiple values are mapped into a single fields in semi-colon seperated fasion.
    The source:
    <MT_dates>
       <date>05-10-2011</date>
       <date>10-11-2011</date>
       <date>10-12-2011</date>
       <date>10-13-2011</date>
    </MT_dates>
    date field is 0.. unbounded
    target
    <MT_dates>
       <dates>05,10,2011;10,11,2011;10,12,2011;10,13,2011</date>
    </MT_dates>
    dates field is 0 .. 1
    can anybody please help?
    Regards,
    Haik

    chk this:
    input will be : var1
    execution type All values of a context
    int a = var1.length;
    String b="";
    for(int i=0;i<a;i++)
    b =b +var1<i> + ";";
    int c=b.length();
    String output =b.substring(0,c-1) 
    result.addValue(output);
    date-UDF--dates

  • Getting BAM Error: BAM-06008: The XML payload is invalid; extra contents we

    Hi All,
    Version: 11.1.1.4
    We are getting the BAM Error: "BAM-06008: The XML payload is invalid; extra contents were found" after I added a another field to a BAM Object. I can see the new field in BAM and I can also see it when I pull up and map to a BAM adapter in my SOA composite. However, when I have the process send a payload with the newly added field it fails with the above error. However, if I add a new data object in BAM with the field it works fine. What would be causing BAM to think that the newly added field should be in payload?
    Any suggestions would be greatly appreciated.
    --S                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    If the layout of the data object changes then you need to restart BAM server for changes to take effect. Also make sure, your mapper file isn't adding extra elements than expected.
    Thanks
    Jahangir Pasha

  • Submit button to create PDF and XML attachment in a single email message

    All,
    We have to submit both an XML file and a PDF file in a single email as the user expects both formats. They do not want to extract the XML from the PDF file. (The PDF file contains some information that is not in the XML but is used for documentation purposes.) We are using Livecycle Designer 8.
    I currently have Javascript code in a button to attach an XML file but would also like to attach a PDF version in the same email:
    event.target.submitForm({cURL
    :"mailto:" + vSubmitTo +"?subject="+LEASEIMPORT.ValidationCheck.Subform55.EmailSubject.rawValue+"&body=Please find the 2 files file to be imported ",cSubmitAs:"XML",cCharset:"utf-8"});
    Thanks in advance
    Lester

    Bill, thanks for replying. I thought I should explain our scenario:
    We have designed a PDF form for data input. This form is distributed as a "stand-alone" PDF - not residing on a server. The user fills in the form which produces a legal document. The user then hits a submit button which produces an XML document which is emailed to a person in the organisation who uses the XML for import into another application. However they also require the PDF document to be emailed as this contains supplementary information which is not contained in the XML file. (i.e. some fields are not exported with the XML file).

Maybe you are looking for

  • Can we build equity and acquire assets without banks while rebuilding credit??

    Hi.Thank you for taking a look at my post.  I hope we can help each other.  I have 3 goals for this post. 1 - to reach out to this community for opinions, leads, and hopefully contact info for private lenders who really do lend based on the asset and

  • IPod will not boot up

    Hi, I've been having a problem booting up my iPod, as in getting it to turn on, for about a week now. Everytime I go to use it, the apple logo flashes and I hear the battery starting to turn on; however, it abruptly stops, and the sad iPod face appea

  • Can i use lens cleaner spray to clean my ipod

    Can i use a lens cleaner spray to clean my ipod touch screen?

  • Reversal of customs MIRO.

    Hi, We have reversed a Customs MIRO due to some incorrect entries. However when I cheked the accounting document of reversal invoice, there are some entries of Price difference account which I am unable to understand. I followed the general procedure

  • Can i use this view in discoverer

    Hello I have a view like below in R12. GL_CODE_COMBINATIONS_KFV In etrm there is a warning: Oracle Corporation does not support access to Oracle applications data using this object, except from standard Oracle Applications programs. Can any one you p