2 Replies Latest reply on Jun 4, 2007 2:38 AM by adurkin

    Passing array to webservice.

    adurkin
      I'm trying to pass an ArrayCollection of business object to a (.NET) webservice method which is expecting an array of business objects of the same structure I am sending. When I call the service method only one object is in the array. It is of the correct type. The other objects are not sent.
      I am trying to do a prototype to convince the technical architect that this product is worth pursuing (which I think it is) so I haven't time to spend a couple of days figuring these details out ie. I'm not just being lazy here!;-)
      TIA
        • 1. Re: Passing array to webservice.
          Ryan@imart Level 1
          Fun, i hate selling technology to directors, isnt that there job to learn whats new?!

          But, adurkin here is what you need to do. It doesnt matter what you pass to and from the service, its a matter of making sure your objects match between flex and .net. Also make sure the service you are using in flex is set to handle OBJECTS by setting the result format to object for each of the functions you have hanging off your service.


          <mx:WebService id="WS" wsdl=" http://localhost:49753/Test_Application/App_Common/Services/ProductSearch.asmx?WSDL"
          useProxy="false"
          fault="Alert.show(event.fault.faultString), 'Error'"
          result="onResult(event)" >
          <mx:operation name="MyFunctionName" resultFormat="object">
          </mx:operation>
          </mx:WebService>

          Let me know if this helps, if it doesnt ill send over an example leave me your email.

          -Ryan
          • 2. Re: Passing array to webservice.
            adurkin Level 1
            Thanks for your input on this Ryan. I've sort of gotten a work around. What I was planning was a business object containing an ArrayCollection of other objects (this is what I was trying to send initially). Anyway, if I send the main aggregate object the call to the service works fine. I may have to revisit this topic if (hopefully!) I get the go ahead to use flex but for now my prototype is doing the right thing.
            Thanks again for your help - the resultFormat advice is definitely relevant in this area.
            Alan.