5 Replies Latest reply on Jul 13, 2006 6:05 AM by inlineblue

    Web Service response message problem

      Hi at all, I've got a problem with WebService component.
      I need to invoke the service and use the xml returned to fill the title of a panel.

      The service declaration is:
      <mx:WebService id="feedRequest"
      wsdl=" http://jsuite:8080/axis/services/SoaTest?wsdl"
      <mx:operation name="getResult">
      <par>Test value</par>

      The xml return message is:

      Now I want to fill the panel with "Test value" so:
      <mx:Panel x="10" y="10"

      The first row of mxml invoke the service:
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"

      The panel title is empty.... why ?
      If I set title="{feedRequest.getResult.lastResult}" the panel title is filled by the entire xml returned from service.....

      Could anyone explain to me what wrong in my test application ?
      Thank you
        • 1. Re: Web Service response message problem
          katerini Level 1
          Hi MarcoBazza,

          I haven't tried this but maybe the syntax is wrong... try casting first {feedRequest.getResult.lastResult} to an XML object. Then trace the tree down to PARAMETRO. For example something like this might do the trick:
          var webXML:XML = XML({feedRequest.getResult.lastResult});
          var title:String = webXML.ROWSET.ROW.PARAMETRO;
          trace("Here's my title: " + title);

          • 2. Re: Web Service response message problem
            ntsiii Level 3
            Binding is hard to debug.

            Set up a result handler function so that you can debug the result object. Often the structure is not exactly what you expect.

            • 3. Re: Web Service response message problem
              inlineblue Level 1

              Originally posted by: MarcoBazza
              The xml return message is:
              <ROW><ROWSET><PARAMETRO>Test value</PARAMETRO></ROW></ROWSET>


              Compare the two. ROW is not a child of ROWSET, it's the root node. What you want is ROWSET.PARAMETRO.
              • 4. Re: Web Service response message problem
                MarcoBazza Level 1
                I'm sorry, I cut and past a wrong xml example....
                The correct XML is : <ROWSET><ROW><PARAMETRO>Test value</PARAMETRO></ROW></ROWSET>
                So I think that the istruction title="{feedRequest.getResult.lastResult.ROWSET.ROW.PARAMETRO}" is correct, but probably
                the problem is that I have to parse returned xml by an ActionScript function because the web service doesn't respect a standar that is expected by Flex....

                I'm newer to ActionScript so I don't now how to parse the xml result, could you post me an example code ?

                Thanks at all!
                • 5. Re: Web Service response message problem
                  inlineblue Level 1
                  One thing to remember about E4X syntax is that you don't explicitly refer to the root node. That's because the XML object is the root node. So in your corrected example, what you want is:


                  The "lastResult" variable actually refers to the ROWSET node.

                  One question though: Since this is a row set, do you have more than one ROW child? If so, the syntax needs to change to:


                  where n is the n'th ROW child.

                  Also, when you're debugging, put in some trace statements so you can see the structure of what you're getting. eg: