0 Replies Latest reply on May 7, 2007 2:39 PM by Andrea Bresolin

    Web Service method and null parameters

    Andrea Bresolin
      I'll try to explain my problem through an example.

      I want to call a method myMethod through a web service myWebService. myMethod has two parameters param1 and param2.
      Sometimes I need to assign NULL value to one of them, so the call could be myWebService.myMethod(null, param2Value).

      Sometimes it happens that Flex sends only the non-null parameter to the web service, while other times it sends both parameters. It seems that this behavior is random. I cannot figure out what kind of policy is adopted to decide if all the parameters should be sent or if only the non-null ones should be sent. This behaviour could be observed with all the web service's method calls that can contain some null values.

      This causes me troubles on the server-side (where the web service is) because I'm using XFire and it checks the number of parameters received for a method call, so it complains if any parameter is missing (it doesn't assume a default value for a missing parameter).

      So, my question is: is there a way to force Flex to send all the parameters (null and non-null ones) when calling a web service's method? And what is the policy adopted by Flex to decide if a null parameter should be sent or not?

      I'll be very grateful to anyone answering my questions, because I kept on trying for many days to find a solution, but without good results. Unfortunately, the source code of the mx.rpc package is not available. It would have been of great help.

      A.B.