Large WebResponse

Last post 11-10-2009 1:40 AM by ido.ran. 2 replies.

Sort Posts:

  • Large WebResponse

    10-20-2009, 8:20 AM
    • Member
      2 point Member
    • ido.ran
    • Member since 03-28-2009, 8:55 AM
    • Posts 5

    Hi,

    I'm using REST starter kit to write a WPF client application which interact with RESTful web service implemented in Java using Glassfish v2.1 container.

    I have tried different approaches for client side data usage as follow:

    1. request only "one-level-deep" entity (for example customer) and only when properties of the customer are accessed retrieve the next level entity (for example customer type as sample of single entity, or list of orders of that customer as sample for list of entities).

    2. request full-graph entity - for example when requesting that customer also get it's customer-type entity and also all of it's orders and their internal entity-graph.


    There is no better way, there is more suitable way for specific need. When I need to use all the information the second way is much (much much) faster because the overhead of HTTP call, de-serialization and more are only done once.

    The problem I saw is that REST starter kit sometime hang when large response returned from the web-service. By large I mean 5MB or response.


    My question:

    1. Is it bad to have such large response?

    2. Does REST starter kit need to have all the answer before deserialization can occur?

    3. What can be better way?

    4. Currently I am using XML serialization, can JSON make a difference?


    Thank you very much,

    Ido.

    Filed under: , , ,
  • Re: Large WebResponse

    11-09-2009, 5:50 PM

    Hi Ido,

    I have seen similiar things happening before (large messages resulting in hanging), and I think I might be able to help you out here.  WCF REST is able to support large responses, no matter XML or JSON.  If you are seeing the client hang, there is a different issue.  Last time when I see this happening, also around a message of 5MB size, the service was hitting a serialization size limit "Mamimum number of items in object graph".  In my case, it was a parameter that can be easily set to a larger number.  I suspect you are seeing something very similar.

    You can enable WCF tracing on your server (http://msdn.microsoft.com/en-us/library/ms732023.aspx) and examine the logs to see if an exception was thrown.  Alternatively, you could use IntelliTrace in Visual Studio to see if any unexpected exception is thrown.  You should be able to get over this hurdle once you see the logs.

     

    -Andrew

  • Re: Large WebResponse

    11-10-2009, 1:40 AM
    • Member
      2 point Member
    • ido.ran
    • Member since 03-28-2009, 8:55 AM
    • Posts 5

    Hi Andrew, Thanks for the answer. I've done further checking and I found that it's not the WCF REST kit that was actually hanging, it was the server.

    My server is implemented as a J2EE application since I think microsoft miss the point with REST, on the service side at least. I love to talk about this issue further since I do like to see Microsoft tools do better job but this is for a different thread.

    So my question now is how can I gzip the answer since the 5 MB answer is what I'm looking for, yet compress it can reduce it to about 20% or less of it's original size.

    I've looked inside WCF Starter Kit and saw there is a GZIP header constant yet I fail to use it. Any insight on that can help me.


    Thank you,

    Ido.

    Filed under: , ,
Page 1 of 1 (3 items)