Note that there are some explanatory texts on larger screens.

plurals
  1. POWCF response is returned as text/html, not xml
    text
    copied!<p>I think something must not be correct with the serialization. My class is:</p> <pre><code>[DataContract] public class User { [DataMember] public int id { get; set; } [DataMember] public string user_id { get; set; } ... public User() { } public User(int id, string user_id, ...) { this.id = id; this.user_id = user_id; ... } } [DataContract] public class UserCollection { [DataMember] public List&lt;User&gt; users { get; set; } [DataMember] public int count { get; set; } [DataMember] public int page { get; set; } public UserCollection() { } public UserCollection(List&lt;User&gt; users, int count, int page) { this.users = users; this.count = count; this.page = page; } } </code></pre> <p>The API call:</p> <pre><code> [WebGet(UriTemplate = "?promotion_id={promotion_id}&amp;page={page}&amp;format={format}")] public UserCollection GetAllUsers(string promotion_id, string page, string format) { if (string.Equals("json", format, StringComparison.OrdinalIgnoreCase)) WebOperationContext.Current.OutgoingResponse.Format = WebMessageFormat.Json; UserFactory factory = new UserFactory(); return factory.GetUsersByPromotionID(int.Parse(promotion_id), (int.Parse(page) - 1) * 50, 50); } </code></pre> <p>The generated source:</p> <pre><code>&lt;UserCollection xmlns="http://schemas.datacontract.org/2004/07/API.Library.Resources" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;count&gt;0&lt;/count&gt;&lt;page&gt;0&lt;/page&gt;&lt;users/&gt;&lt;/UserCollection&gt; </code></pre> <p>It doesn't display the xml on the page because it says the response type is text/html. Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload