views:

61

answers:

2

1st of all, apologies if this is a basic/simple WCF question, i'm a WCF newbie and haven't come across this so far.

Question 1 - Is there a way to see what data is marshalled on a wcf service call ?

and given the following definitions

Interface IX
{
   List<string> list;
   Dictionary<string,MyType> dict;
}

Interface IY : IX
{
   List<string> list2;
   Dictionary<string,MyType2> dict2;
}

Interface IService 
{
   DataSet MethodX( IX arg);
   DataSet MethodY( IY arg);
}

class service : IService { }
class A : IY { }

where the service is hosted on a separate machine

Question 2 - what gets transported across when calling MethodX & MethodY as follows

 A instance = new A();
 service s = new service();
 // init instance & Service
 s.MethodA(instance);              // what carries over to service on machine B ?
 s.MethodB(instance);              // same question - full A or only properties of IY ?
+1  A: 

Answer 1: To see serialized data you can use WCF message logging.

Answer 2: Nothing. Code will throw exception because there will be no serializable type for arg parameter.

Ladislav Mrnka
will take a look at the logging stuff,
Kumar
A: 

I won't touch on your example, as I'm not sure if its psuedo code or not, and I think as you learn you'll realise where it makes lots of assumptions.

For now:

Install "Fiddler" and launch it (from a new menu in IE) and see the actual traffic pass over the wire.

Or, get to grips with the DataContractSerializer first. Build and serialize some classes in a simple Console Application and understand what's going on, before involving WCF.

http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx

WCF, in a very crude sense, is a system for automatically building API definitions (WSDL), establishing network connections, (de)serializing objects and sending them over the connection and routing them the right method in a remote class.

Keep your test application for future troubleshooting when you inevitably come across WCF errors.

It's always good to know your classes/contracts serialize without errors in the test rig, and if they don't, it's easier to see the errors and solve the problem in a Console App than it is using WCF apps.

Luke

Luke Puplett
@Luke: it a _very_ crude sense. You omit REST-based services, which don't use WSDL or any form of metadata; bindings that don't use a network (netMsmqBinding); and not every service is based on a method in a remote class (some don't even run on .NET)
John Saunders
Absolutely. My point is that all this stuff is about data exchange and hence serialization - keep it simple, the guy's just starting out.
Luke Puplett
this is non-web server so can't use fiddler
Kumar