1 Reply Latest reply on Jul 26, 2006 12:42 PM by Peter Farland

    [Help Wanted] soap1.1 webservice, filling a tree with the result of calls...


      I'm having trouble with filling a tree with the result to calls to a document/wrapped soap 1.1 webservice.

      I first declared the webservice in the mxml file as it was in the examples and tried to call it with no luck. The fault was it wasn't finding the document type for the call's unique parameter. I figured out the solution to this, I added a method in the webservice declaration having a single element named the same as the required parameter, and inside it, the "actual" parameters, bound to variables defined elsewhere.

      The reason for wanting the tree to be filled programatically, is the potential whole contents of the tree can be about 1.000.000 nodes. Huge.


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="initM()">
      import mx.collections.ArrayCollection;
      import mx.controls.Alert;
      import mx.controls.treeClasses.TreeListData;

      [Bindable] public var aParentId:String = null;
      [Bindable] public var aLevel:Number = 0;

      <mx:WebService id="lws" wsdl=" http://myServer/myContext/myPortURI?WSDL" useProxy="false" makeObjectsBindable="true">
      <mx:operation name="getNodes" resultFormat="object">
      <mx:Tree x="0" y="0" width="326" height="100%" id="layoutTree" enabled="true" labelField="nodeName">
      public function initM():void {

      So, here's the problem:

      1.- In both Java2 and .NET, I've been able to produce sets of proxy classes from the webservice wsdl, these include a proxy class for the service port and a set of classes for both the call parameter types and the call result types. I have not found yet a way to do the same with flex2, so I wonder, can I produce the required classes for dealing with such a webservice in an automatic way with flex2?

      2.- The second problem, is I haven't found a way to make a webservice call in sychronous mode, and I can't seem to find a way to set the parameters for the subsequent calls to the webservice. Is there a way to make a call to such webservice programatically? I mean, I've been able to make the first call I need programatically, but what if I end up making 2 or more simultaneous calls? I can't rely on setting the `variables defined elsewhere` before each call, because of possible concurrency issues (calls will be long after the 2nd level of the tree), so I wonder if there's a way to make a call to such webservice (document/wrapped, soap1.1) passing it the parameters programatically. If so, can I just put the parameters or do I have to produce the complete enclosure? If I have to produce also the enclosure, any hint on how to do so? I will need to pass different parentId, level pairs probably triggered by tree events.

      3.- the other problem, finally, is Tree looks quite different to me than the Java2 one. In java2, I can easily produce a changing model for the tree wich will even handle the calls to the webservice as needed (triggered by the tree itself), making it a `live model`. If there is a way to produce the same behaviour in flex2, I haven't found it yet. Sure, I've only downloaded the trial version yesterday, so I may have overlooked some docs or blogs.

      Any hints would be appreciated, specially on programatically modifying the tree, and making calls to the webservice changing the parameters every time.
        • 1. Re: [Help Wanted] soap1.1 webservice, filling a tree with the result of calls...
          Peter Farland Level 3
          1. Not yet, but we're looking into supporting this in an upcomming release.

          2. All RPC requests must be made asynchronously... this is a restriction of the way the Flash Player makes network requests (otherwise movies, which are single threaded, would hang waiting for results). You should be able to use the ActionScript API to programmatically call web services with normal parameters.

          3. If you leave makeObjectsBindable="true" (which it is by default) the Objects and Arrays will be wrapped in ObjectProxies and ArrayCollections automatically and will report change events, however I don't believe that we have an example that links these change events up to subsequent web service calls, but it would be possible (but not automatic). A feature that does do this sort of thing automatically is the Data Service, although this does not use WSDL/SOAP to describe/communicate with remote services and you have to setup a Java assembler to work with our adapters on the server.