1 Reply Latest reply on Nov 17, 2006 10:28 AM by atxatx

    Webservice parameters - out / inout mode

    atxatx
      Hello,

      I have a problem with parameters in webservice call.

      One of my webservice's parameters is defined as "OUT" direction, that is it "acts as another return value": the webservice sets the value of this OUT parameter and after I call the WS, I should be able to read back this value in my client.

      However, after the WS call Flex only lets me access "main" result of WS - in "lastResult" property of WS tag. I do not know how to get the value of that OUT parameter...

      The only solution I found is to switch resultFormat on WS's <mx:operation> tag to "e4x", then I can get whole server response and read the OUT parameter from there. This is not a good solution for me though, as the response will be XML - it will not be parsed to Objects, as it is in default resultFormat setting; and I really need to have it parsed.

      So: do you have any other idea how to access webservice OUT mode parameters in Flex?

      Example:

      • WS definition in C#:
        [WebMethod]
        public string OutParamTest (out string outParam) {
        outParam = "This is my parameter with mode set to OUT. Come to papa!";
        return "This is normal return value";
        }

      • Flex:
        <mx:WebService id="testWS" wsdl="..." result="Alert(testWS.OutParamTest.lastResult)">
        testWS.OutParamTest ()
        // displays "This is normal return value". How to get to the "This is my parameter with mode set to OUT" ???


      • Example SOAP result from WS call:
        <?xml version="1.0" encoding="utf-8"?>
        <soap:Envelope xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Body>
        <OutParamTestResponse xmlns=" http://tempuri.org/">
        <OutParamTestResult>This is normal return value</OutParamTestResult>
        <outParam>This is my parameter with mode set to OUT. Come to papa!</outParam>
        </OutParamTestResponse>
        </soap:Body>
        </soap:Envelope>

      • WSDL of webservice (generated automatically):
        (...)
        <s:element name="OutParamTestResponse">
        <s:complexType>
        <s:sequence>
        <s:element minOccurs="1" maxOccurs="1" name="OutParamTestResult" type="s:int" />
        <s:element minOccurs="0" maxOccurs="1" name="outParam" type="s:string" />
        </s:sequence>
        </s:complexType>
        </s:element>
        (...)
        • 1. Webservice parameters - out / inout mode
          atxatx Level 1
          Didn't find the solution, but I solved my problem in another way - I am adding data, that I wanted to pass in OUT parameters, to SOAP response headers. The headers can be read in Flex with no problems (although they're accessible as XML only, they will not be de-serialized to objects).