2012-12-14 47 views
0

我試圖找出爲什麼我的HTTPService導致Flex是返回回多個XML頭..Flex HTTPService組件返回多個XML頭

C#的WebAPI服務:

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

     return categories; 
    } 

的調用上的結果這個webservice是;

<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> 

我HttpService的內部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)); 

好吧,那麼畢竟,當成功的事件被觸發我response.result看起來像這樣:

response

我一直在爭論這個問題幾個小時了,我縮小了它不能成爲我的web服務,因爲它顯示正確時,我通過Chrome或IE撥打電話。有什麼建議麼?

+0

在設置params.companyId後查看是否正確設置了斷點。也許你將null傳遞給了服務,所以它將返回所有的類別,而不僅僅是與id匹配的類別。 –

+0

它正在返回適當的數量,這不是問題;問題在於它正在爲Web服務的每個結果返回一個新的xml集合。據我所知,它不應該從源中爲每個記錄返回多個xml對象。 – jhartzell

回答

0

這是按預期工作,它看起來完全陌生。對困惑感到抱歉!請關閉這個。

+0

您可以刪除您的問題或接受您的答案作爲解決方案。 – Zesty