Select to view content in your preferred language

consuming .net webservice that returns array of tables

833
2
12-01-2010 08:16 AM
RickBaker
Emerging Contributor
I'm trying to pull data from a .Net webservice when selecting a parcel feature on the map. In Flash Builder 4 I can use the Data Services wizards to generate forms for input and displaying response from webservices that return a single table. Some of my webservices return an array of tables. When running the "Test Operation" in FB4 on that webservice the test results come back fine (see attachment: TestResults.jpg). When I try to use the wizard to generate the input and response forms FB4 is unable to configure the result type, etc, correctly. I get a couple errors in the source code:
1067: Implicit coercion of a value of type mx.rpc:CallResponder to an unrelated type Class
1118: Implicit coercion of a value with static type Object to a possibly unrelated type valueObjects:RXPN_DocumentsForParcelResult.

Since the "test Operation" works, I know it's possible to get the correct data returned, but programmatically I can't figure it out.
Tags (2)
0 Kudos
2 Replies
DavidGalluzzo
Deactivated User
I don't use the widzards but write my own code to do this. Depending on you code skill level this process is pretty essay.

Step 1: Create .net web service to return data table.
Step 2: Create flex class for calling web service.
Step 3:  Call service
Step 4: work with results.

I have attached some code and below is an example of getting results to an ArrayCollection. If you are returning an array of tables you may have to loop through the results and assign each table to an array collection. The key is to understand the how the results are being returned and this depends on the .net code. in this case below my .net code returns a data table. If you need more help my email is david.galluzzo@dhs.gov


//gets Spot Incidents in system and stores inside array
public function gotSpotIncidents(e:ResultEvent):void{
        if(e.result.Tables.Table.Rows.length > 0){
var table:* = e.result.Tables.Table.Rows;
spotIncidentsArr = new ArrayCollection();
spotIncidentsArr = table; // Assign Results to branches Array
         }
CursorManager.removeBusyCursor();
}
0 Kudos
RickBaker
Emerging Contributor
Thanks David. That gets me moving in the right direction. I'll email you when I get stuck again.

rick
0 Kudos