Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WCF Messaging Hub Serialization/Deserialization 1

Status
Not open for further replies.

RealQuiet

Programmer
Feb 11, 2001
54
0
0
US
We have a WCF messaging hub. A publisher sends a message object to a method on the service, and the service distributes the message to subscribed recipients. The message object includes a MessageData property of type object.

We have defined an class to which the publisher and subscribers all have a reference. So far, so good.
The problem is that the messaging hub does not have a reference to this class, so when the messaging hub receives the WCF message, a serialization exception occurs. We don't want to have to redeploy the messaging hub with updated references every time we decide to send a new object through the MessageData.

I don't know if it is even possible (doubtful), but I guess I'm looking for a way to tell the messaging hub to just pass the object through without caring about what type it is. I'd appreciate any input anyone has for a good solution to this.

As a workaround, we have manually serialized the object into XML and sent that as a string in the message. Since the hub knows about strings, everything is ok.
 
Or you can create a base type for the objects that you pass around.

If I expect to receive an Invoice (via a WCF transfer object base class) if & when I cast it back to an Invoice (using the as keyword) I can check it for null & handle the problem nicely.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks Chip, I will give this a shot. I guess I figured that since it wouldn't work with object that it wouldn't work with some other base type. I'll try it and post back what I find out.
 
The difference is that a base type would likely have the [ignore][DataContract] and [DataMember][/ignore] attributes applied.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks again, Chip. We're under a tight deadline right now, so we're going with the manual serialization method for the initial rollout. Once we get through the go-live, we will revisit and hopefully get it working with the method described. I will keep this flagged so I remember to come back and update once we have put it in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top