I want to transform an object into a XML-String

Hallo,
in my BSP I want to transform an object into a xml string to set a server side cookie.
Therefore my code is:
  DATA:
    lv_xml      TYPE string,
    lv_username TYPE string.
model    ?= get_model( model_id = 'main' ).
  lv_username = sy-uname.
  Call TRANSFORMATION id SOURCE o = model  RESULT XML lv_xml.
  cl_bsp_server_side_cookie=>set_server_cookie(
        name                  = 'MODEL'
        application_name      = runtime->application_name
        application_namespace = runtime->application_namespace
        username              = lv_username
        session_id            = runtime->session_id
        data_value            = lv_xml
        data_name             = 'MODEL'
        expiry_time_rel       = 3600 ).
But after the command "Call Transformation" the xml-string doesn't contain all the data of my object, only this:
<?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><O href="#o19"/></asx:values><asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary"> <cls:ZCL_M_ESS_TRV_OVW id="o19"/
></asx:heap></asx:abap>
What is wrong?
Regards.
Martin

see thread nr.: Re: Call transformation with an object

Similar Messages

  • Convert  Objects into an XML Document? Possible?

    Hello,
    Is there a way to convert different objects into an XML File/Document
    If I create 10 objects and then I want to create an XML Document
    of these objects,is it possible to do this?
    Ajay

    Hello,
    Is there a way to convert different objects into an
    XML File/Document
    If I create 10 objects and then I want to create an
    XML Document
    of these objects,is it possible to do this?
    Ajayjust override the .toString() method...

  • How to convert  information of a job posting into a xml string or file

    hi hr experts,
    I hope to find some answers.
    Is there a function in the ERP system that converts all the information of a job posting into a xml string or file?
    This could be used to communicate with external job databases, e.g. monster or jobpilot.
    The function CALL TRANSFORMATION converts data to XML. Is this really the only way to convert the job posting?
    Thanks for your feedback and help.
    Ralf von Seht
    Edited by: Ralf von Seht on Mar 26, 2008 4:45 PM
    Edited by: Ralf von Seht on Mar 26, 2008 4:46 PM

    Hi Elena,
    The issue is caused by XSLT is not script enabled by default.  Please provide XsltSettings in the loading to fix the issue. For more information, please see:
    http://daomingworks.wordpress.com/2009/12/11/xslt-transform-data-error-use-the-xsltsettings-enablescript-property-to-enable-it/
    Thanks,
    Jinchun Chen
    Jinchun Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)

  • Save an Image object into a XML text document

    ello:
    I have a problem with saving an image. I need to encapsulate it into two XML tags:
    <Image> xxxxxx </Image>
    The "xxxx" must be a String that represents my Image object.
    In J2ME I haven't serialization, and all the examples about "manual serialization" works with primitive types :(
    I've already read that I can do .getRGB() over my Image object, and obtain an array of int, wich represent each pixel. Ok, I can transform the array into a String, and write it in my XML text document, but later: how I obtain my array from that String?
    Thak you very much

    private Image img;
    byte rgb[] = null;
    private rgbLength; // get lenth of your string
    rgb = new byte(rgbLength);
    rgb = ... //load data from string to this array
    img = createRGBImage(rgb, int width, int height, false) ;You must know length of your string and must encapsulate in to XML width and height of this image;

  • Getting Error while creating Document object  after  parsing XML String

    Hi All,
    I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    Please find the code below which i have been experimenting with:
    import java.io.BufferedReader;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.StringReader;
    import java.util.List;
    import java.util.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import java.io.*;
    public class TestMain {
         public static void main(String[] args) {
              String file = "";
              file = loadFileContent("C:\\Test.xml");
              System.out.println("contents >> "+file);
              parseQuickLinksFileContent(file);
    public static void parseQuickLinksFileContent(String fileContents) {
    PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
         try {
    DocumentBuilderFactory factory =           DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         StringReader objRd = new StringReader(fileContents);
         InputSource objIs = new InputSource(objRd);
         Document document = builder.parse(objIs); // HERE I am getting Error.
         System.out.println(document.toString());
    What is happening while I am using builder.parse() method ???
    Thanks,
    Rajendra.

    Getting following error
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.

  • Best way to transform an object into a circle?

    Let's say I have a long rectangle I want to warp into a circle, what would be the best way to go about doing this?

    Drag the rectangle into the Brushes palette.
    In the resulting dialog, define an Art Brush.
    Draw a circle.
    Apply the Art Brush to the circle.
    JET

  • Error while creating DocumentBuilderFactory object for parsing XML string

    When I try to execute the following statement in an EJB class,
    DocumentBuilderFactory df=DocumentBuilderFactory.newInstance();
    I get the following exception:
    javax.xml.parsers.FactoryConfigurationError: Provider org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not found
    When the same statement is executed from a standalone java class, it works fine.
    The IDE used is Visual Age for Java.
    The JAXP package used is JAXP 1.0.1
    Can anybody please let me know how can we overcome this problem?
    Thanks and Regards,
    Shashi Anand B
    E-Mail : [email protected]

    javax.xml.parsers.FactoryConfigurationError: Provider
    org.apache.crimson.jaxp.DocumentBuilderFactoryImpl not
    foundI suspect that this may be due to a classpath issue and/or a Java version issue. Doe your Visual Age installation use Java 1.3? Do you have Sun Java 1.4 also installed on your system? It may be that when you are executing from a standalone Java class, that you are using the Java 1.4 runtime, which include the org.apach.crimson.* classes. Earlier version of Java do not include this, although it may be in the JAXP package.
    I think that your Visual Age IDE is configured such that the DocumentBuilderFactory is unable to find the appropriate implementation.
    I hope this helps!
    - David

  • Embed JavaFX object into JSPX page

    Hi guys,
    I developed a RIA using javaFX and now want to embed this object into a JSPX page. In the page I wrote following sentences,
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
              xmlns:afh="http://xmlns.oracle.com/adf/faces/html">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
            <f:view>
                <af:group>
                    <afh:script source="http://dl.javafx.com/1.2/dtfx.js"/>
                    <afh:script>
                        javafx(
                            archive: "myJavaFX.jar",
                            draggable: true,
                            width: 1080,
                            height: 540,
                            code: "path.Main",
                            name: "myJavaFX"
                    </afh:script>
                </af:group>
            </f:view>
    </jsp:root>I used Oracle Jdeveloper as my IDE and weblogic server as application server. I put the .jar files of myJavaFX application into same folder as the .jspx page.
    To my surprise, when the web page was generated, the application was not displayed but showing the following sentence,
    javafx( { archive: "firstJavaFX.jar", draggable: true, width: 1080, height: 540, code: "path.Main", name: "firstJavaFX" } );Obviously, the logic of my script was not recognized. Instead, it's printed out directly.
    So what could I do with this? Any helpful comments would be greatly appreciated.
    Regards from Isaac.

    This forum is devoted to JSF, JavaServer Faces, which is unrelated to the technologies you are using. You might get a better response in a forum devoted to JavaFX or JSP.

  • Object into OutputStreams..

    Hello guyz,
    I want to put an object into an Output Stream(Just raw Output Stream).
    Is this possible??If so how can i do that...??
    Please help me I wud be grateful
    Regds,
    Gokul

    public void putIn (OutputStream out, Serializable object) {
        new ObjectOutputStream (out).writeObject (object);
    }

  • Transforming a DART_VIEW into a DART_EXTR

    Dear Gurus,
    I have a problem in Data Retention Tool (DART).  I had made the following steps:
    - Extract the data with the transaction FTW1A (Extract Data) creating a file (BIN) u2013 ZTEST;
    - Transaction FTWH (Data Extract Views) selected a view that I had previously created and put in the ZTEST file a filter (Document Type = KZ). Creating a file u2013 ZVIEW;
    And now I want to have the file ZVIEW transformed into an Extract File just like ZTEST.
    So for short I want to transform a DART_VIEW into a DART_EXTR. Itu2019s that possible?
    I need a way to filter the file ZTEST (like document type) and have the possibility to SAVE with the same name and in the same u201Cplaceu201D.
    Thx in advance,
    Best regards,
    Rui Ribeiro

    Hello!
    For the files already created you cannot change the header. It would be against to accounting principles, you should not change data already stored in production.
    For the new files you can switch off the flag  "insert header line"  at the selection screen of the view as mentioned above.
    REgards,
    REnan

  • Converting EJB Object into XML

    All:
    Suppose I have an EJB that is named MyDog, it has attributes as follows:
    name
    breed
    weight
    age
    Is there a way to convert this Object into an XML document? Something like:
    <?xml version=\"1.0\" ?>
    <MyDog>
    <name>Bubba</name>
    <breed>Australian Shepherd</breed>
    <weight>65 lbs</weight>
    <age>6 years old</age>
    </MyDog>
    I can't find any information on doing this - any ideas, links, etc? There has to be a way to do this, but I can't find it. I'm welcome to any ideas out there!

    check JAXB - might be usefull for you: http://java.sun.com/xml/jaxb/index.html

  • How to transform common object to xml string

    I know that I can import xml dtd a the common data type in iStudio. However, does anyone know how to serialize it back to the xml string during the field mapping? Is it even possible?
    Thanks,
    Edward

    Thanks Stuart for your reply. What I'm trying to do is to convert the xml message from the common view object to JMS Text Message. I declared the application data type as AQ$JMS_TEXT_MESSAGE and I try to map the common data type which is I imported from dtd to the application JMS type. During the mapping I need to serialize the common data type object back to xml string, so I can copy it to text_vc field defined in JMS Text Message (String type).
    Or do you know any other alternative to convert from RAW XML payload type to JMS payload type in iStudio?
    Thanks,
    Edward

  • How to create XML string for an object matching the result of a marshal?

    I'm trying to create a XML string representation of an object which exactly matches the XML which results from marshalling the object into a request. I'm almost there except that the XML string I come up with is missing the attribute "standalone=\"yes\"" in the topmost xml element, and this attribute is present in the marshalled XML. I'm using the XML string to create a payload signature which must match exactly with the XML payload of the request, so the two XML representations of the object really do need to be identical.
    Here's what I'm doing to create the XML from the object:
       private String myObjectToXmlString (final MyObject myObject)
           throws Exception {
                 try {
               DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
               Document document = documentBuilder.newDocument();
               myObjectMarshaller.marshal(myObject, document);
               Source source = new DOMSource(document);
               StringWriter stringWriter = new StringWriter();
               Result result = new StreamResult(stringWriter);
               TransformerFactory factory = TransformerFactory.newInstance();
               Transformer transformer = factory.newTransformer();
               transformer.transform(source, result);
               return stringWriter.getBuffer().toString();
           } catch (Exception ex) {
               throw new Exception("Unable to convert a MyObject object to an XML String -- " + ex.toString(), ex);
       }The XML which is produced looks like this:
    <?xml version=\"1.0\" encoding=\"UTF-8\"?>
    <ns2:myObject xmlns:ns2=\"http://sunconnection.sun.com/xml\">
       <myObjectId>0</myObjectId>
       <objectType>1</objectType>
       <description>Test Object</description>
    </ns2:myObject>The payload object is marshalled to the request like so:
        // marshall the MyObject to the output stream
       OutputStream outputStream = myHttpUrlConnection.getOutputStream();
       myObjectMarshaller.marshal(myObject, outputStream);
       outputStream.flush();
       outputStream.close();When I view the XML payload of the request it looks like this:
    <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
    <ns2:myObject xmlns:ns2=\"http://sunconnection.sun.com/xml\">
       <myObjectId>0</myObjectId>
       <objectType>1</objectType>
       <description>Test Object</description>
    </ns2:myObject>As you can see the two XML representations of the object are identical except for the standalone attribute in the xml element.
    It'd be a hack to make the assumption that the standalone attribute will always be there in the marshalled object and to just hard code it into the XML string returned by my object to XML method. Since I'm using the same Marshaller to create the XML string as I am to perform the marshalling to the request I assume that there's some way to make it give the same XML in both cases, and that I'm doing something wrong in my method which converts the object to an XML string. If anyone can see where I'm going wrong in that method (myObjectToXmlString() above), or can suggest a better way of doing this, then I'll certainly appreciate the insight.
    --James                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    It turns out that I was taking the wrong approach in my object to XML string method. A cleaner/better way to do it, which gives the correct result, is this:
        private String myObjectToXmlString (final MyObject myObject)
            throws Exception {
            try {
                ByteArrayOutputStream stream = new ByteArrayOutputStream();
                myObjectMarshaller.marshal(myObject, stream);
                return stream.toString();
            } catch (Exception ex) {
                throw new Exception("Unable to convert a MyObject object to an XML String -- " + ex.toString(), ex);
        }--James                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Can we include a Document into a XML Form

    Hi!
    If I want to attach a document into a XML Form is posible?
    i.e an Excell Document.
    Thanx in Advanced!
    Gerardo J

    Hi Gerardo,
    The info it's on my brain, jejeje, I have some experience with XML Forms. I really don't think you can attach (by standard/default) anything to an xml form, everything is a refence (even images).
    XML Forms generates xml files, witch are rendered thru layouts and the configuration you set in the RenderList and Show forms.
    Unless you find some kind of deployment that unifies the xml document with the file you want you will have to work with the references (link).
    Best Regards,
    Jorge M.

  • Using Simple Transformations with Objects tt:copy .. results in Exception

    Question:
    How can I serialize an ABAP-Object-Instanz with my own simple transformation?
    In the sap-documentation I found the following solution for the serialisation of any data-objects.
    "z_steffens_simple_transf":
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="ROOT"/>
      <tt:template>
        <root>
          <tt:copy ref="ROOT"/>
        </root>
      </tt:template>
    </tt:transform>
    Following the example I wrote this report:
    report  zspahr_test_simple_transf.
    class serializable definition.
      public section.
        interfaces if_serializable_object.
        data attr type string value 'Attribute'.
    endclass.         
    method main_serializable.
        data: oref type ref to serializable,
              xmlstr type xstring.
        create object oref.
        call transformation id
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
        call transformation z_steffens_simple_object
          source root = oref
          result xml xmlstr.
        call function 'DISPLAY_XML_STRING'
          exporting
            xml_string = xmlstr.
      endmethod.                    "main_
    start-of-selection.
      demo=>main_serializable( ).
    Executing this report leads to an exception "CX_SY_REF_NOT_SUPPORTED".
    The "standard" transformation "ID" ist working an translates my object-instance into an asXML representation:
      <?xml version="1.0" encoding="utf-8" ?>
    - <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
    - <asx:values>
      <ROOT href="#o3" />
      </asx:values>
    - <asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:abap="http://www.sap.com/abapxml/types/built-in" xmlns:cls="http://www.sap.com/abapxml/classes/global" xmlns:dic="http://www.sap.com/abapxml/types/dictionary">
    - <prg:SERIALIZABLE xmlns:prg="http://www.sap.com/abapxml/classes/program/ZSPAHR_TEST_SIMPLE_TRANSF" id="o3">
    - <local.SERIALIZABLE>
      <ATTR>Attribute</ATTR>
      </local.SERIALIZABLE>
      </prg:SERIALIZABLE>
      </asx:heap>
      </asx:abap>
    How can I do this with my own Simple Transformation "ZSPAHR_TEST_SIMPLE_TRANSF" ?
    I want to serialize my object using my own xml-structure, not the asXML-structure !
    Regards
    Steffen

    Hi,
    try like this,i think it may help you.
    ABAP:
    CALL TRANSFORMATION ztrans_test
          SOURCE
               root = partab
         RESULT XML lv_xstring.
    Trnsformation:
    <tt:root name="ROOT" type="?"/>
    <tt:template>
    <VALUES>
    <VALUE_SOURCE>
            <tt:value ref=".ROOT"/>
    </VALUE_SOURCE>
    <VALUE_PARAM>
    <tt:value ref="NAME"/>
    <tt:value ref="VALUE"/>
    </VALUE_PARAM>
    </VALUES>
    Thanks,
    Rajesh.

Maybe you are looking for

  • Credit note

    Dear All, When the customer returns goods,the basis for calculating the price in returns should be on  the billing date of the main invoice.like if customer returns goods  in the same month the price should be as in billing document (say 40,000)  if 

  • Boot Another iMac off a Mini?

    Would it be possible to boot a G4 700 Flat Panel off of a Mini? Or to put it another way, could I use the G4 FP as a monitor for a Mini? If it is possible, how is the connection made: Firewire or Ethernet? Glenn

  • Where can I find a JSP sample app?

    Folks, I 've been searching for hours for a simple sample jsp application that uses beans to interact with a database and has add, edit, delete functionality. I'm sure their are oodles of them out there somewhere but it's proving a nightmare trying t

  • Re: Satellite L500D - Touchpad "touch" not working

    Hi everyone, my touchpad's touch function (to emulate left-clik by tapping the touchpad) is not working any more. I can move the mouse with the pad. Also the left button below the pad is not working - the right one is. I've already tried : -Updating

  • Cannot install elements inspiration browser

    Attempting to installed Elements Inspirational Brower but getting the following error & will not install: