Utility to deserialize request data

Utility to deserialize request data

Old forum URL: forums.lhotka.net/forums/t/12335.aspx


raesene posted on Monday, January 27, 2014

Hi,

I'm looking at a Silverlight application written using CSLA and I was wondering if there are any utilities available to deserialize data as seen in Fiddler, to show it in an ASCII/readable sense?

At the moment I can see requests with XML elements but as all the data is serialized, it's kind of hard to debug.

Thanks

Rory

 

sergeyb replied on Monday, January 27, 2014

IMHO, you should instead log on the server or the client.  Stream could be quite large, and Fiddler will likely truncate it anyway.  On both server and client you can implement custom proxy/server class and log from that class.  You could de-serialize the data there and look for whatever information you are looking for.

raesene replied on Tuesday, January 28, 2014

thanks for the response :)

At the moment I only have access to the client and not the server so I guess I'll need to work from that end.  Do you know are there is there any sample code I could look at for deserializing dataportal requests?

Thanks

Rory

sergeyb replied on Tuesday, January 28, 2014

if you download samples for version 4.3.1 http://www.cslanet.com/Download.html you will find InventoryDemo under Samples\Silverlight\cs.  It has proxy class and host class, both doing compression of the stream.  Instead of compression you can do logging.  Without access to the server I think you will struggle though.

raesene replied on Tuesday, January 28, 2014

Thanks, I'll go look at them.

You're likely right about it being tricky without the server ..

JonnyBee replied on Tuesday, January 28, 2014

I wonder what issues do you actually have in debugging. 

If you have no access to the server side AND you also must have the same business objects assembly on the client side - then what is the issues you have to debug? 

The problem with a custom Proxy is that this intercepts the data BEFORE it is deserialized - so you will only get the data, as- is, on the wire. 

You should rather look into the IInterceptDataPortal interface as this hooks into the dataportal BEFORE or AFTER the data has been serialized/deserialized. This is a better place to do some custom logging. 

 

/// <summary>
/// Implement this interface to create a data
/// portal interceptor that is notified each
/// time the data portal is invoked and
/// completes processing.
/// </summary>
public interface IInterceptDataPortal
{
  /// <summary>
  /// Invoked at the start of each server-side
  /// data portal invocation, immediately after
  /// the context has been set, and before
  /// authorization.
  /// </summary>
  /// <param name="e"></param>
  void Initialize(InterceptArgs e);
  /// <summary>
  /// Invoked at the end of each server-side
  /// data portal invocation for success
  /// and exception scenarios.
  /// </summary>
  /// <param name="e"></param>
  void Complete(InterceptArgs e);
}


This interface is introduced in CSLA 4.5.

Read more about it here: http://www.lhotka.net/weblog/MoreDataPortalEnhancementsForCSLA45.aspx

 

raesene replied on Wednesday, January 29, 2014

Hi, 

Thanks for the information.  In terms of the debugging, I'm doing a black-box security review of an app based on silverlight and CSLA, so it would be useful for that to be able to look at the content of messages as they go over the network, beyond just seeing the serialized data.

cheers

Rory

Copyright (c) Marimer LLC