7 Replies Latest reply on Oct 29, 2007 3:00 PM by flxkid

    consuming .NET SOAP Services with byref params

      I need to access a webservice where all of the functions have parameters that are passed "byref". So far this doesn't seem to work in flex. Maybe someone can tell me how to do this. The wsdl is here:


      Of course, the parameters aren't REALLY byref, but that is how some languages consume them. So far I can pass them correctly, but in lastResult the byref param isn't coming back. Is flex capable of correctly accessing this web service?

        • 1. Re: consuming .NET SOAP Services with byref params
          Hi Oliver,

          can you give us a small example how you have tried to use the webservice in flex
          ( cause you have the impression that it didn´t work ).

          Which function you have tried to call ( the wsdl got 20 and more functions) ?

          You may have problems in dealin with the <complextype> of the wsdl.
          Try to instaniate a new Object and create the parameters to the object .

          For "GetPublicKeyResponse" it would be something like the following AS3 code:

          var aObject:Object = new Object();
          aObject.GetPublicKeyResult = my_GetPublicKeyResult; // created before
          aObject.PublicKey = my_publickey;

          best regards,

          • 2. consuming .NET SOAP Services with byref params
            flxkid Level 1
            I will be a bit busy over the next day or two. I'll try and report back with your code. Mine is just using an MXML operation. When I debug it is sending the data correctly but I'm not getting back the out param (byref param) in lastResult or anywhere else that I can expand in the from in the debugger although the call is executing successfully. Unfortunately I can't give you data to call one of these functions as it gives access to a restricted system.

            I am going to see about setting up a system that can be accessed by others so that I can get some help with this. Note that I have spent about 10 hrs on Flex/Actionscript so I'm quite new to this environment. Thank you for your help and please bare with me.
            • 3. Re: consuming .NET SOAP Services with byref params
              flxkid Level 1

              I've called the web service just using some mxml to describe it and then the call:
              <mx:WebService id="wsConneXion"
              wsdl=" http://univac.hallmarkins.net/ConneXion/ConneXion.asmx?wsdl"
              <mx:operation name="FindUserForWhoCode">

              The operation works, but on the return I can only get back the FindUserWhoCodeResult, the Security object isn't accessible even though it is coming back. Here is what comes back (from the debugger in another language):

              <soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema">
              <FindUserForWhoCodeResponse xmlns=" http://AppliedSystems.com/TAM/ConneXion/">
              <Number>0</Number><Source></Source><TAMErrorNumber></TAMErrorNumber><TAMSource></TAMSourc e><TAMDescription></TAMDescription>
              <UserName>Tom Name </UserName>

              Notice how the security object is returned outside of the Result object but in the response object. This is how .NET does byref or out params. But I can't seem to access this piece (which in my case is the important piece) from flex.

              Any advice would be appreciated.


              • 4. Re: consuming .NET SOAP Services with byref params
                ntsiii Level 3
                Start by doing this:

                Set resultFormat="e4x" on the WebService tag. Otherwise, result is converted to a nested object structure.

                Then, in the result handler, do this:
                var xmlResult:XML = XML(event.result);
                trace(xmlResult.toXMLString()); to see exactly what you have in flex.

                • 5. Re: consuming .NET SOAP Services with byref params
                  flxkid Level 1

                  I see the result coming back just as I quoted in my previous message. So I can atleast get to it. Are you suggesting that I access this webservice via this means rather than the parsed object interface? That would be just fine by me, I just want to confirm that you weren't having me do this as a debugging step for another solution.

                  • 6. consuming .NET SOAP Services with byref params
                    kcell Level 2
                    Hi Oliver,

                    the response is ok cause the wsdl defines
                    FindUserForWhoCodeResponse ....
                    <s:element ... name="FindUserForWhoCodeResult" ype="tns:ConneXionResult"/>
                    <s:element ... name="Security" type="tns:Security"/>

                    So if you set a break point in the return handler, you will see that "event.result" contain a "object" named "Security", with the nested tag objects.
                    You can put a result handler to the webservice (operation) and add a AS3 script section:

                    import mx.rpc.events.ResultEvent;
                    import mx.controls.Alert;

                    public function resultHandler(event:ResultEvent):void {
                    Alert.show("in result handler");

                    and modify the operation ( I think its the operation, not checked it )

                    <mx:operation name="FindUserForWhoCode"> result="resultHandler(event)" >

                    Ntsii´s tip of using "e4x" is a good point, cause its always better to use e4x than the "old" object structures. Specially if you currently start to implement you should use "e4x" (and learn something about it). ( the resultformat can be set as attribute of the webservice in the mxml)

                    For the "byref" problem it shouldn´t make a difference. Set a breakpoint in the resulthandler and check the variables/expression window in the debugger.

                    best regards,

                    • 7. Re: consuming .NET SOAP Services with byref params
                      flxkid Level 1

                      I've got this working now. I had to setup a namespace. But it seems that when I'm setup this way, I loose bindability. I can't put in:

                      wsConneXion.FindUserForWhoCode.lastResult.Security.Username into the text property of a textinput. In fact, a watch on this expression fails even. But I can use the expression from AS just fine...

                      I'm going to see what I can find myself, but is there something simple I can do to regain the ability to bind when using e4x?