tags:

views:

108

answers:

2

I am implementing a WCF service based on a 3rd party WSDL. Rather than process the messages synchronously, I want to dump the xml into a database, and have it processed by another part process. Is using the WCF Message class directly the right way to go ab out this? Or should I just let WCF deserialize the message and the re-serialize so I can put it in the database?

To clarify, I can't use the WCF MSMQ binding because the 3rd party has dictated this will be a soap web service. I just want to queue the messages on my end somehow so the processing can by asynchronous.

+1  A: 

Could you possibly use MSMQ ? That's the classic message-queueing system, and it's supported by WCF.

You could receive the message from that third-party service and then just put it in the MSMQ for later processing.

As for message vs. deserialized object: both will work ok, but I think having a real .NET object is a bit easier to deal with.

Some more info:

marc_s
Thanks for the reponse. Unless I misunderstand, the server would have to be msmq as well right? The server side is already defined, it has to be a soap web service.
Robin Clowers
So you're connecting to a third-party server you cannot influence? No problem - you get the message / object from the remote server in your client app, and then you stick it into a MSMQ queue for later processing, and just return back a e.g. confirmation number or something to the third-party. Would that work?
marc_s
Yes, that would work, I'm just trying to understand if I have to let wcf deserialize the message or if I can grab the message before that and stick it in the queue.
Robin Clowers
Robin: you can do both; I find working with deserialized .NET objects easier than dealing with the low-level "Message" class directly.
marc_s
A: 

Is there a reason you want them to go to the DB at all? Investigating MSMQ as an applicable alternative might be smart here... this way it is closer to a config change, rather than a lot of custom development.

If you do need to do this, I would recommend creating a custom channel stack (both client and server) for the purpose. Then, yes, you would simply be serializing and deserializing the Message.

Anderson Imes
Thanks for the response. The server is 3rd party and is not going to change, so that is not a possibility.
Robin Clowers