Binding XML object to XMLConnector

Is it possible to dynamically bind an XML object to an
XMLConnector in ActionScript; and if so, how?
Thanks.

Any takers on this?

Similar Messages

  • Issues with binding an XML object

    Hi all.
    I'm doing a quick data editor for a game I'm working on using
    AIR and flexbuilder. Anyway, I've stored all the data in an XML
    object and I'm binding various controls to the XML object. But I've
    come across a weird issue when I update the data.
    Basically I create a datagrid thats bound to the XML
    (basically it reads a list of companies from the XML object). I
    also have a MXML form thats bound to the same data (only from a
    single company at the selected index of the datagrid).
    So its all working neatly, apart from one thing. When I
    select different rows from my datagrid, I'm getting strange
    behavior from my update function (which simply sets the XML objects
    values to the values in my form fields). Its as though there is
    some caching going on within the data binding thats essentially
    overriding my text edit fields .text properties.
    Strangely enough, the update works, but not the first time
    you select a new row from the datagrid.
    So I'm wondering if there is some method to use to invalidate
    any caching of data (its almost like the text is being retrieved
    from a cache and stored back into the edit fields text property).
    I'd added the MXML code for the app. Although the app reads
    an XML file in the storage directory so its unlikely you'll be able
    to run it. But if you need the xml, here it is:
    <companies>
    <company>
    <companyname>Ericson</companyname>
    <companydesc>Some kind of description
    here</companydesc>
    </company>
    <company>
    <companyname>Vodaphone</companyname>
    <companydesc>This is another
    description</companydesc>
    </company>
    <company>
    <companyname>Smother</companyname>
    <companydesc>Wingles another
    description</companydesc>
    </company>
    </companies>
    Hope someone can shed some light here.

    You could try the Apache XMLBeans 2.1.0.
    I have the same need to use xs:any datatype and, at least, XMLBeans do not fail in the bean generation process.
    Cheers.

  • ActionScript to bind XML data to components

    How can I use ActionScript to bind XML data to a comboBox
    component instead of using the component inspector? (I have done
    the latter, successfully, but that doesn’t allow access to
    the code - .)
    My ActionScript so far imports the data (the trace picks it
    up) – but the ‘cbType.dataProvider line’
    doesn’t work. It works when I change the data provider to an
    array – so what am I doing wrong?
    MY CODE:
    import mx.data.components.XMLConnector;
    var xcFestival:XMLConnector = new XMLConnector();
    xcFestival.ignoreWhite = true;
    xcFestival.direction = "receive";
    xcFestival.URL = "festivalItems.xml";
    xcFestival.trigger();
    //POPULATE THE COMPONENTS WITH THE DATA
    var festXMLlistener:Object = new Object();
    festXMLlistener.result = function(evt:Object) {
    trace(xcFestival.results);
    cbType.dataProvider = xcFestival.results;
    xcFestival.addEventListener("result",festXMLlistener);

    This is on a stand - alone system
    Using Designer ES ......
    I saved the Form as an xdp form
    and it seems as if all goes well until
    View the data and nothing appears - or
    just the names of the fields appear

  • Conversion of string into XML object

    Hi
    I am having some problems with conversion of string (containing XML data) into Flex XML object and binding it later to UI elements to output/maintain this data.
    Binding of XML structure to UI elements works perfectly fine if I will do following:
    1)      Hardcode XML object within Flex file
    2)      Read xml file from repository (xml file inside the Flex project)
    3)      Use HTTP request to retrieve XML data
    Unfortunately none of the above scenarios suits my solution.
    I am developing a prototype application for processing Flex forms inside SAP system. I have decided to make data bindings using XML structure stored in Data Base. When rendering form inside web browser based application I am retrieving corresponding XML schema (empty for new forms and populated for saved forms) and pass it to Flex form as a string type import parameter. Data is being passed correctly (I can display it on TextArea control for instance) but after conversion to XML and binding to DataGrid I am not getting any results.
    I am converting string (containing XML) to XML object in following way:
    Private var xml_obj:XML = new XML(string_xml );
    I am catching any potential errors but conversion is going well. After conversion I am not getting any results after binding it to DataGrid control and I am not able to access any of the nodes using AS code either. At the same time variable xml_obj is not empty (not null).
    Any help would be much appreciated.
    Regards
    Michael

    David
    First of all sorry for not stating it clearly but I am using Flex 3 for this development (at the moment it is the only choice when embedding Flex objects inside SAP applications).
    You must have missed the bit where I am describing how this XML data finds its way inside Flex. I am passing it to Flex as String type parameter during rendering (directly from DB where it is stored).
    Now, following code works perfect (XML is embedded inside Flex project):
                    <mx:XML id="form_data" source="../assets/example_xml_data.xml"/>
                    <mx:Script>
                                    <![CDATA[
                                                    import mx.collections.XMLListCollection;
                                                    import mx.controls.Alert;
                                                    [Bindable]
                                                    public var XML_list:XMLListCollection;
                                                    private function setParameters():void
                                                                   XML_list = new XMLListCollection(form_data.*);             
                                    ]]>
                    </mx:Script>
                    <mx:DataGrid id="myDataGrid" dataProvider="{XML_list}">
                                    <mx:columns>
                                                    <mx:DataGridColumn dataField="COMMON" headerText="Popular name"/>
                                                    <mx:DataGridColumn dataField="BOTANICAL" headerText="Botanical name"/>
                                                    <mx:DataGridColumn dataField="ZONE" headerText="Zone"/>
                                                    <mx:DataGridColumn dataField="LIGHT" headerText="Light"/>                                                                                                                                               
                                                    <mx:DataGridColumn dataField="PRICE" headerText="Price"/>                                               
                                                    <mx:DataGridColumn dataField="AVAILABILITY" headerText="Availability"/>                                    
                                    </mx:columns>               
                    </mx:DataGrid>
    But following code does not work (XML passed to Flex form as String input parameter):
    import sap.FlashIsland;
    import mx.controls.Alert;
    import mx.collections.XMLListCollection;
    [Bindable]
    public var xml_data:String;
    private var form_data:XML;
    [Bindable]
    private var XML_list:XMLListCollection;
    private function initApp():void
                    FlashIsland.register(this);
    private function setParameters():void
                    try
                                    form_data=new XML(xml_data);
                    catch (error:Error)
                                    Alert.show(error.toString());
                      XML_list = new XMLListCollection(form_data.*);           
    XML string does find its way inside Flex form. I can display content of variable xml_data in TextArea and all looks fine. Conversion to XML (variable form_data) goes well (no error)
    Please helpJ
    Regards
    Michael

  • Properly binding an object to a custom component.

    I am apparently not doing this. What am I missing to properly
    bind an
    object from a repeater looping over an array of object to the
    custom
    component called in the repeater?
    <mx:Repeater
    id="dayCells"
    dataProvider="{days}"
    startingIndex="{weekRows.currentItem}"
    count="7">
    <mx:GridItem
    width="14%"
    borderColor="black"
    borderThickness="1"
    borderStyle="solid">
    <mx:Label
    text="{dayCells.currentItem.formatedDate}" />
    <ian:dayFormat2
    drawData="{dayCells.currentItem as drawDay}"
    test="{dayCells.currentItem.formatedDate}" />
    </mx:GridItem>
    </mx:Repeater>
    {days} is an array of drawDate.as objects returned with a
    remoteObject.
    I can correctly bind properties of these drawDate objects in
    the
    lable and the test property of the dayFormat2
    customComponent. But I
    can NOT correctly bind the entire object over to dayFormat2.
    What am I
    missing?
    My current version of dayFormat2.mxml, I have tried several
    alternatives
    for this file.
    ?xml version="1.0" encoding="utf-8"?>
    <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    <mx:Script>
    <![CDATA[
    import drawDay;
    //Define public variables
    [Bindable]
    public var drawData:drawDay;
    [Bindable]
    public var test:String;
    ]]>
    </mx:Script>
    <mx:DateFormatter id="dayNum" formatString="DD" />
    <mx:HBox
    backgroundColor="0x002649"
    width="100%"
    horizontalAlign="right">
    <mx:Label
    text="{test}"
    color="white" />
    <mx:HBox
    backgroundColor="0xAF1E2D"
    horizontalAlign="center">
    <mx:Label
    text="{dayNum.format(drawData.date)}"
    color="white" />
    </mx:HBox>
    </mx:HBox>
    <mx:Label text="foobar" />
    </mx:VBox>
    The first label bound to the test String works correctly. The
    second
    label bound to the drawData drawDay object date property does
    not work
    correctly.
    What is the proper way to bind this object?

    I have struggled with this all day and made no headway. The
    only
    strange thing I get is with this line:
    <mx:Label text="{dayCells.currentItem.toString()}" />
    outputs [object Object]
    Not the expected string from this drawDay.as function.
    // toString()
    public function toString():String
    return "Date: " + formatedDate;
    Ian Skinner wrote:
    > I am apparently not doing this. What am I missing to
    properly bind an
    > object from a repeater looping over an array of object
    to the custom
    > component called in the repeater?
    >
    > <mx:Repeater
    > id="dayCells"
    > dataProvider="{days}"
    > startingIndex="{weekRows.currentItem}"
    > count="7">
    > <mx:GridItem
    > width="14%"
    > borderColor="black"
    > borderThickness="1"
    > borderStyle="solid">
    > <mx:Label
    > text="{dayCells.currentItem.formatedDate}" />
    > <ian:dayFormat2
    > drawData="{dayCells.currentItem as drawDay}"
    > test="{dayCells.currentItem.formatedDate}" />
    > </mx:GridItem>
    > </mx:Repeater>
    >
    > {days} is an array of drawDate.as objects returned with
    a remoteObject.
    > I can correctly bind properties of these drawDate
    objects in the lable
    > and the test property of the dayFormat2 customComponent.
    But I can NOT
    > correctly bind the entire object over to dayFormat2.
    What am I missing?
    >
    > My current version of dayFormat2.mxml, I have tried
    several alternatives
    > for this file.
    >
    > ?xml version="1.0" encoding="utf-8"?>
    > <mx:VBox xmlns:mx="
    http://www.adobe.com/2006/mxml"
    width="100%">
    > <mx:Script>
    > <![CDATA[
    > import drawDay;
    >
    > //Define public variables
    > [Bindable]
    > public var drawData:drawDay;
    >
    > [Bindable]
    > public var test:String;
    > ]]>
    > </mx:Script>
    >
    > <mx:DateFormatter id="dayNum" formatString="DD" />
    >
    > <mx:HBox
    > backgroundColor="0x002649"
    > width="100%"
    > horizontalAlign="right">
    > <mx:Label
    > text="{test}"
    > color="white" />
    > <mx:HBox
    > backgroundColor="0xAF1E2D"
    > horizontalAlign="center">
    > <mx:Label
    > text="{dayNum.format(drawData.date)}"
    > color="white" />
    > </mx:HBox>
    > </mx:HBox>
    >
    > <mx:Label text="foobar" />
    > </mx:VBox>
    >
    > The first label bound to the test String works
    correctly. The second
    > label bound to the drawData drawDay object date property
    does not work
    > correctly.
    >
    > What is the proper way to bind this object?

  • Is XML object [Bindable] by default ?

    Hello all
    Consider the popup window that lets you change few values that are stored in XML or discared changes and leave model with original values.
    Two input values are bound to model properties.
    How would you overcome the issue marked red in following code ?
    Should  i set initial values in action script code instead of using binding in XMXL?
    Another option is to define model as Object like this :
    private var model:Object=new XML (<nodes> <node label=
    "label1" data="data1"/> 
    <node label=
    "label2" data="data2"/> 
    </nodes>);
    so it is not [Bindable] and t1.text is not get updated when model is touched.
    What is your "pattern" for implementing saveChanges/discardChages  requirement?
    Thanks
    THE CODE :
    <mx:Script>  
    <![CDATA[
    private var model:XML=<nodes> <node label=
    "label1" data="data1"/>
    <node label=
    "label2" data="data2"/>
    </nodes>
    private function update():void{
        model.node[0].@label=t0.text;
      // after the execution of previous line t1.text is changed back to original value
      // and we loose t1.text entered value
        model.node[1].@label=t1.text;
         closeMe();
    private function closeMe():void{
       // close code
    ]]>
    </mx:Script>  
    <mx:TextInput id="t0" text="{model.node[0].@label}"/>
    <mx:TextInput id="t1"  text="{model.node[1].@label}"/>
    <mx:Button click="update()" label="Save changes" />
    <mx:Button click="closeMe()" label="Discard changes" />

    I suggest having two local variables, something like:
      private var data0:String;
      private var data1:String;
    If the XML is defined at compile time, then you can initialize them directly:
      private var data0:String = model.node[0].@label;
      private var data1:String = model.node[1].@label;
    Otherwise, use a Binding two synchronize them:
      <mx:Binding source="model.node[0].@label" destination="data0"/>
      <mx:Binding source="model.node[1].@label" destination="data1"/>
    Then tie together the local variables and the TextInput controls.  If the XML is defined at compile time, you could do this in an creationComplete event handler.  If not, then you'll want to make data0 and data1 Bindable and let data binding initialize them:
      <mx:TextInput id="t0" text="{data0}"/>
      <mx:TextInput id="t1"  text="{data1}"/>
    Lastly, in your update() function, you can push the changes from data0 and data1 back into the XML object.  I should note that if the XML isn't defined at compile time and you don't use data binding, then you'll likely run into initialization issues.  For example, if data0 and data1 are created before model.  Data binding can be an expensive convenience, though, so if you know exactly when model is created, you could initialize data0 and data1.  You could even optimize them out, and assign directly from the model to t0.text and t1.text.  Then in your update() function, you could push them back to the XML object.  You probably don't want the model to have to know about the TextInput controls, so you might want to dispatch an event and have the document listen for that event.  Lots of options.  Good luck.

  • Howto dynamicly bind XML element to a TextInput using BindingUtils?

    The question is: Howto dynamicly bind XML element to a
    TextInput component using BindingUtils?
    Now I use following codes:
    <!--
    [Bindable] private var xml: XML =
    <item><label>list1</label></item>;
    // initialize code for application's initialize event
    private function init(): void {
    BindingUtils.bindProperty(txtDemo, "text", xml, "label");
    //click event
    private function test(): void {
    xml.label = "something";
    // txtDemo.executeBindings(); //---- no use anymore
    -->
    <mx:TextInput id="txtDemo"/>
    <mx:Button label="Test" click="test()"/>
    My really idea is when bindable xml property is changed, then
    the textinput will be updated as hoped. However, no update happens
    to me when I click the Test button.
    But, if I make codes like that:
    <mx: TextInput id="txtDemo" text="{xml.label}"/>
    the text will updated when xml changs.
    So, what happened, I indeed need the dynamicly bind to the
    textinput compont.
    Help me. thanks.

    You could use an ObjectProxy since all subproperties will
    then be bindable:
    private var _xml:XML =
    <item><label>list1</label></item>;
    private var _opXML:ObjectProxy = new ObjectProxy(_xml);
    then in your init() function you declare _opXML as the host
    object with the bindable property "label"...
    // initialize code for application's initialize event
    public function init(): void {
    BindingUtils.bindProperty(txtDemo, "text", _opXML, "label");
    //click event
    private function test(): void {
    _opXML.label = "something";
    You'll notice that if you check your original _xml.label
    property with ChangeWatcher.canWatch(), it returns false. But if
    you create a dedicated object with a property that can be declared
    as bindable, canWatch() returns true. You'd probably be best off to
    write a lightweight class that can act as your model if you want to
    work with dynamic XML binding using Actionscript. This will allow
    you to use a bindable getter and setter that will give you the
    dynamic functionality you're looking for.
    Hope that helps.

  • Reading XML object from Request object

    Hi,
    We are using Flash in our web application in which we are sending an XML object using HTTP post method to a JSP where we need to parse the XML object and get the values. Can anyone tell how we can do it?

    In fact we are not getting error in our page. following is the error
    Error: 500
    Location: /team/par/getData10.jsp
    Internal Servlet Error:
    java.lang.IllegalArgumentException
         at javax.servlet.http.HttpUtils.parseQueryString(HttpUtils.java:151)
         at javax.servlet.http.HttpUtils.parsePostData(HttpUtils.java:254)
         at org.apache.tomcat.util.RequestUtil.readFormData(RequestUtil.java:101)
         at org.apache.tomcat.core.RequestImpl.handleParameters(RequestImpl.java:719)
         at org.apache.tomcat.core.RequestImpl.getParameterValues(RequestImpl.java:259)
         at org.apache.tomcat.core.RequestImpl.getParameter(RequestImpl.java:250)
         at org.apache.tomcat.facade.HttpServletRequestFacade.getParameter(HttpServletRequestFacade.java:223)
         at org.apache.jasper.servlet.JspServlet.preCompile(JspServlet.java:437)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:480)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
         at org.apache.tomcat.core.Handler.service(Handler.java:287)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
         at java.lang.Thread

  • Creating and Binding View Objects dynamically : Oracle Jdeveloper 11g

    Hello,
    We are trying to create and bind view objects dynamically to adf data visualization components.
    The view object is a result of multiple tables.
    We are using Oracle JDeveloper 11g Technical Preview. ( can't upgrade to TP2 or TP3 now).
    We have found this : http://radio.weblogs.com/0118231/stories/2003/07/15/creatingUpdateableMultientityViewObjectDefinitionsDynamically.html on our search for the same.
    The sample application however, is in 10g , hence required migration.
    Also, it was a standalone application with the TestClient.java having a main() method.
    Our requirement is for Web Application; we use Adf+jsf .
    Guidance of any sort is very much appreciated.
    Thanks in advance.
    -Anil Golla

    Hi,
    there also exist a forum for JDeveloper 11: JDeveloper and OC4J 11g Technology Preview
    What you are trying todo is not trivial because you need to not only dynamically create the VO, you would also dynamically need to create the binding meta data for it (assuming you use ADF). Not sure if the API to modify the binding is public, so posting it on the JDeveloper 11 forum bears a glimpse of hope for an answer
    In JDeveloper 10.1.3 you can't do this
    Frank

  • Passing data from an XML object to an itemRenderer

    I'm trying to color the background of a column in a datagrid and have found a sample file that illustrate the concept. However, the sample has data stored in an arrayCollection whereas mine is in an XML object. The problem is that the data in the sample file is apparently automatically passed to the itemRenderer (shown below: note the trace statement). My XML object does not appear to automatically pass data to the itemRenderer. So my questions are:
    1. Is there a simple way to pass data stored in an XML object to an itemRenderer
    or
    2. Should I convert my XML to an arrayCollection? If so, what's the best way to do this-- I've tried the following, but without success:
    <mx:Model id="xmldata" source="example3.xml"/>
      <mx:ArrayCollection id="myAC" source="{ArrayUtil.toArray(xmldata.Example1)}" />
    Here's what the xml looks like:
    <TABLE>
       <EXAMPLE1>
          <difficulty> 0.5 </difficulty>
          <discrimination> 0.7 </discrimination>
          <item> 3 </item>
       </EXAMPLE1>
    </TABLE>  
    Here's the itemRenderer:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml">
        <!--
            This item renderer simply extends Label and overrides the updateDisplayList function to
            draw a gradient-filled rectangle. The colors in the gradient are determined from the
            data.
        -->
        <mx:Script>
        <![CDATA[
            import flash.geom.Matrix;
            import flash.display.GradientType;
            import flash.display.Graphics;
            override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
                super.updateDisplayList(unscaledWidth,unscaledHeight);
                var m:Matrix = new Matrix();
                m.createGradientBox(unscaledWidth,unscaledHeight);
                var g:Graphics = graphics;
                            trace("data.col3="+data.col3)
                var colors:Array = (data.col3 < 2000 ? [0x0000CC,0x0000FF] : [0x00CC00,0x00FF00]);
                g.clear();
                g.beginGradientFill(GradientType.LINEAR, colors, [0.2,0.6], [0,255], m);
                // the rectangle is drawn a little high and a little tall to compensate for the gap
                // the DataGrid introduces between rows.
                g.drawRect(0, -2, unscaledWidth, unscaledHeight+4 );
                g.endFill();
        ]]>
        </mx:Script>
    </mx:Label>

    This sample code should answer your question of how to bring data into the renderer automatically. It comes in via the DataGrid dataProvider and then you refer to it in the renderer as data.XYZ, where XYZ is the field in the XML with the data. See FB 3 help sys on e4x syntax.
    ------------------ mainapp.mxml --------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="srvc.send();">
      <mx:Script>
        <![CDATA[
          import mx.rpc.events.ResultEvent;
          import mx.collections.XMLListCollection;
          [Bindable] private var xlc:XMLListCollection;
          private function dataHandler(evt:ResultEvent):void{
            xlc = new XMLListCollection(evt.result..EXAMPLE1 as XMLList);
        ]]>
      </mx:Script>
      <mx:HTTPService id="srvc" url="data2.xml" result="dataHandler(event)"
        resultFormat="e4x"/>
      <mx:DataGrid dataProvider="{xlc}">
        <mx:columns>
          <mx:DataGridColumn headerText="Difficulty" dataField="difficulty"/>
          <mx:DataGridColumn headerText="Discrimination" dataField="discrimination"/>
          <mx:DataGridColumn headerText="Item" itemRenderer="MyLabel"/>
        </mx:columns>
      </mx:DataGrid>
    </mx:Application>
    ----------- MyLabel.mxml --------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Label xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import flash.geom.Matrix;
          import flash.display.GradientType;
          import flash.display.Graphics;
          override protected function updateDisplayList(unscaledWidth:Number,
            unscaledHeight:Number):void{
            super.updateDisplayList(unscaledWidth,unscaledHeight);
            this.text = data.col3;
            var m:Matrix = new Matrix();
            m.createGradientBox(unscaledWidth,unscaledHeight);
            var g:Graphics = graphics;
            var colors:Array = (data.col3 < 2000 ? [0x0000CC,0x0000FF] : [0x00CC00,0x00FF00]);
            g.clear();
            g.beginGradientFill(GradientType.LINEAR, colors, [0.2,0.6], [0,255], m);
            g.drawRect(0, -2, unscaledWidth, unscaledHeight+4 );
            g.endFill();
        ]]>
      </mx:Script>
    </mx:Label>
    ------------ data2.xml ----------------
    <?xml version="1.0" encoding="utf8"?>
    <TABLE>
       <EXAMPLE1>
          <difficulty> 0.5 </difficulty>
          <discrimination> 0.7 </discrimination>
          <col3> 3 </col3>
       </EXAMPLE1>
    </TABLE>

  • Placing a variable value into an XML Object

    I am trying to figure out how I would get the value of a variable into an XML Object.
    I have the variable
    var dragonName:String = "Samuel";
    var listing:XML = new XML();
    listing = <thedragon>
                            <dragon>
                                  <myname> dragonName.valueOf()</myname>
                             </dragon>
                   </thedragon>
    However, the dragon name does not show up when I go trace(listing);
    How do I do it and should I have imported something as well or what?

    yeah - in fact you can do all sort of things. This is extremely useful when you creating an XML dynamically e.g.
    var names:Array = ["Sammy", "Samuel", "Sancho"];
    var xml:XML =     <dragon>
                         <myname>{Math.floor(Math.random()*names.length) < 2 ? names[1] : names[Math.round(Math.PI) - 1]}</myname>
                      </dragon>;
    or you can even run a function:
    var xml:XML =     <dragon>
                         <myname>{dragonName()}</myname>
                      </dragon>;
    private function dragonName():String {
       return "Samuel";

  • Calling Bpel Process From a Jsp(Need a string output instead of XML object)

    Hi
    I am calling a BPEL process(Synchrononus) from a JSP page, Where Bpel process calls a java web service.The output from Bpel process is returned as an XML object. I need the output in a string format.Please let me know the steps to get the string output.
    I also executed invokeCreditRatingService.jsp(from samples shipped with SOA Suite) that calls CreditRatingService bpel, but i was getting the following output where the rating value is printed as an XML object.
    Output:-
    BPELProcess CreditRatingService executed!
    Credit Rating is oracle.xml.parser.v2.XMLElement@9511c8
    Please let me know, what changes i need to make to get the string output.I followed all the steps given in "orabpel-Tutorial7-InvokingBPELProcesses.PDF" to execute credit rating jsp.
    We are using SOA Suite 10.1.3.1.0 version.Do I need to make any changes to the code, to make it work with this version.
    Thanks
    Vandana.

    The call payload.get("payload") returns, as you have observed, an XMLElement. You can simply convert the XMLElement into an XML string by using a DOMSerializer implementation. The following code is very useful for this purpose:
    http://javafaq.nu/java-example-code-432.html
    Best,
    Manfred

  • How can i filter an xml object on an attribute?

    I want address an xml object with .(@ attributeNameHere == "textToSearchForHere") and have it return the node it’s associated with. 
    This is the text from the adobe help site and it’s similar to my actual code.  I’m querying this xml object: staticVar.employee.(@id=="347").  FlashBuilder 4.7 is returning an error “No such variable: @id”. when I look in debugger.
    This example is found in Adobe's help site: Adobe Flash Platform * Traversing XML structures
    The help site says
    The following expressions are all valid:
    x.employee.(lastName == "McGee")—This is the secondemployeenode.
    x.employee.(lastName == "McGee").firstName—This is thefirstNameproperty of the secondemployeenode.
    x.employee.(lastName == "McGee").@id—This is the value of theidattribute of the secondemployeenode.
    x.employee.(@id == 347)—The firstemployeenode.
    public var staticVar:XML = 
    <employeeList>
          <employee id="347">
               <lastName>Zmed</lastName>
               <firstName>Sue</firstName>
               <position>Data analyst</position>
          </employee>
          <employee id="348">
               <lastName>McGee</lastName>
               <firstName>Chuck</firstName>
               <position>Jr. data analyst</position>
          </employee>
    </employeeList>;
    I’m expecting this: staticVar.employee.(@id=="347") will return the following node:
    <employee nu="347">
    <lastName>Zmed</lastName>
    <firstName>Sue</firstName>
    <position>Data analyst</position>
    </employee>
    If this is the wrong, then what is the correct way to access the xml node based on an attribute?  How can i get that node 347 in this example to be found and returned?  I've opened a ticket with the adobe help team and we're on the 8th day and they have not been helpful at all.

    If you are using e4x as the result format for your service
    you can do the following
    //a XMLList of all day information
    var result:Object = event.result.day;
    //consits all information for month zero
    var month0:XMLList = result.(@month == 0);
    //consists of booking info for day 28 of month 0
    var day28Month0:XMLList = month0.(@day == 28);
    //this also can be done
    //contains booking info for all months for day 28
    var day28AllMonths:XMLList = result.(@day == 28);
    Using this technique you should be able to gather info about
    all user selected dates and build the smaller (filtered) list.
    HTH

  • How to create a xml object dynamically

    Hi all,
    In my current project the database is returning the query result in xml string format(using oracle's DBMS-XML package).
    Now I need to use this xml string and build a xml object and transform it into XSLT and then in a servlet and then pass it to the browser and display it using xsl stylesheets.
    Can some one help me in building an xml object using a string( the xml string is in the xml format i.e in <..> format) and then transform it into xslt in the servlet and send across to the browser.
    Any hands on code or references to the code will be most favourable.
    any help regarding this issue will be most appreciated. Pls do reply as early as possible as I do not have much time to implement this.
    Thanking in advance for your kind help.
    Srinivas.

    What's an "xml object"?
    If you want to transform it using XSLT (transforming it "into" XSLT doesn't make much sense), you can transform direct from the string. Like this:try {
      TransformerFactory xformFactory  = TransformerFactory.newInstance();
      Source xsl = new StreamSource("your.xsl");
      Transformer stylesheet = xformFactory.newTransformer(xsl);
      Source request  = new StreamSource(new StringReader(yourXMLString));
      Result response = new StreamResult(out);
      stylesheet.transform(request, response);
    catch (TransformerException e) {
      System.err.println(e);
    }By the way, if you haven't seen this code before then I suggest you go and read ERH's book about XML with Java:
    http://www.cafeconleche.org/books/xmljava/chapters/index.html

  • String to xml object java

    Hello,
    can anyone suggest me how to convert string to xml object in java?
    I have a string (Data) ant now I have to pass it as parameter as xml object, which structure should be:
    <MGWData>Data</MGWData>
    Where I surf I always see only solutions for converting string to xml document, but never to xml object.
    maybe the problem is I don't completely understand what xml object is in first place :/
    Any answer would help.
    Thanks.

    894871 wrote:
    here is the method to call:
    +/**+
    * Sets the p_DATAXMLTYPEIN value for this SVARCHAR2INSERT_RECEIVESInput.
    *+
    * @param p_DATAXMLTYPEIN
    *public void setP_DATAXMLTYPEIN(com.oracle.xmlns.orawsv.SISTEMA_MOKA.MGW_PUBLIC_FUNCTIONS.SVARCHAR2INSERT_RECEIVESInputP_DATAXMLTYPEIN p_DATAXMLTYPEIN) {*
    this.p_DATAXMLTYPEIN = p_DATAXMLTYPEIN;
    one of the classes contains:
    *public class SVARCHAR2INSERT_RECEIVESInputP_DATAXMLTYPEIN  implements java.io.Serializable, org.apache.axis.encoding.AnyContentType {*
    *private org.apache.axis.message.MessageElement [] _any;*
    this method and some classes where generated using eclipse and wsdl file by creating web service client.
    wsdl says for that part: *<xsd:element name="P_DATA-XMLTYPE-IN">*
    So I suppose it should involve smth org.apache.axis.message.MessageElement. But when I create any type of parameter, it gives me error:
    + ....cannot be cast to com.oracle.xmlns.orawsv.SISTEMA_MOKA.MGW_PUBLIC_FUNCTIONS.SVARCHAR2INSERT_RECEIVESInputP_DATAXMLTYPEIN+
    I am new in web service stuff so thank you for response.Can you explain in plain English what you are trying to do? Or provide a [url http://sscce.org/]SSCE.

Maybe you are looking for

  • Set BAPITID in JCO.Structure

    hello all, i'm using JCO to monitoring CCMS architecture; i need to read properties of each MTE of CCMS. my problem is: i have a TID set of value for an MTE and i want to get results from the bapi: BAPI_SYSTEM_MTE_GETPERFCURVAL my code: nodes = table

  • Max date by month in expression builder

    Hello I'd need to create a new logical column and use the expression builder to make this column return only the last day of each month. I know at answers level I can write something like this in the formulas: Max(Date by month). However I can't do t

  • Service Hierarchy in shopping cart - SRM 7.02

    Hi, SRM 7.02 doesn't support Service Hierarchy in Shopping Cart. Has anyone ever customized standard shopping for service hierarchy functionality. Your comment...! Regards, -N

  • Syn. between Oracle, Access and SQL Server

    In my system, it involved three different db i.e. Oracle, MS Access, MS SQL Server. Is there way to perform syn. automatically when the data of one of the db is changed? p.s. Three DB is located on different NT Server machine.

  • Enterprise Manger

    I have installed SAP ERP 2005 SR2 with Oracle Ander Linux Red Hat 4. And now, I want to install enterprise manager to manage the database. My problem is that I have tried to install em with the commands: $ emca –repos create $ emca –config dbcontrol