0
votes

I am trying to figure out why my HTTPService result in flex is returning back multiple XML headers..

C# WebAPI Service:

    [HttpPost, HttpGet]
    public List<vwRecord24Category> GetClientCategories(int companyId)
    {
       var categories = Db.Fetch<vwRecord24Category>(@"SQLQUERY", companyId);

        return categories;
    }

The result of a call on this webservice is;

   <ArrayOfvwRecord24Category xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Record24Entities">
    <vwRecord24Category>
        <CategoryName>John Doe</CategoryName>
        <Name>adsf</Name>
    </vwRecord24Category>
    <vwRecord24Category>
        <CategoryName>John Doe</CategoryName>
        <Name>df</Name>
    </vwRecord24Category>
    <vwRecord24Category>
        <CategoryName>John Doe</CategoryName>
        <Name>new thing 4</Name>
    </vwRecord24Category>
    <vwRecord24Category>
        <CategoryName>John Doe</CategoryName>
        <Name>Surgery Center 1</Name>
    </vwRecord24Category>
</ArrayOfvwRecord24Category>

My HttpService inside Flash Builder (ActionScript 3.0):

params.companyId = clientData.data.companyId;           

httpService.method = 'POST';
httpService.url = 'http://****.domain.com/record24api/content/GetClientCategories';
httpService.contentType = "application/json";
httpService.resultFormat = "e4x";
httpService.addEventListener(ResultEvent.RESULT, onLibrariesLoaded);
httpService.addEventListener(FaultEvent.FAULT, onLibraryLoadError);

httpService.send(JSON.stringify(params));

Alright so after all of that when the success event is fired my response.result looks like so:

response

I have been battling this issue for several hours now and I've narrowed down that it can't be my webservice as it's displaying correctly when I do a call to it via chrome or IE. Any suggestions?

1
put a breakpoint after you set params.companyId and see if it is getting set properly. Maybe you are passing null to the service, so it is returning all of the categories rather than just the ones matching the id. - Jason Reeves
It is returning the proper amount that's not the issue; the problem is that it is returning a new xml collection for each result from the web service. To my knowledge it should not be returning multiple xml objects per record from the source. - jhartzell

1 Answers

0
votes

This is working as intended it just looked completely foreign to me. Sorry for the confusion! Please close this.