.NET Framework Bookmark and Share   
 index > Windows Communication Foundation > WCFtoMSMQ Example
 

WCFtoMSMQ Example

	   OrderProcessorClient client = new OrderProcessorClient("OrderResponseEndpoint");
            MsmqMessage<PurchaseOrder> ordermsg = new MsmqMessage<PurchaseOrder>(po);
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
            {
                client.SubmitPurchaseOrder(ordermsg);
                scope.Complete();
            }
            Console.WriteLine("Order has been submitted:{0}", po);
I have go the above code from

http://www.microsoft.com/downloads/details.aspx?FamilyID=ed9c315c-31ac-4ccb-b62b-721af1e2bfa8&displaylang=en

Could anyone throw light on how SubmitPurchaseOrder function is implemented. I can see only declarations for this in the code provided by Microsoft.

Any help would be greatly appreciated.
Regards, Praveen
Praveen Chellaboina
HiPraveen,
Please download a .Net Reflector,It is free,You can find more impletmentation of this method.

Regards
Frank Xu Lei--谦卑若愚,好学若?
专注?NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum
Frank Xu Lei
Praveen,

Remember the Client is sending to the Message Queue and the service is recieving from the queue. this is configured in the client app.config, where the client is configured to enque messages and later the sercvice willd deque them in its "public static void ProcessOrder(Object source,ReceiveCompletedEventArgs asyncResult)"

rememberthe client doesn't send directly the service its all indirect thru the message queue!

hope this helps
Hassanh
Hi Hassanh,

I want to Create a sample project which is similar to the above function

	client.SubmitPurchaseOrder(ordermsg);
1. Using this function, I need to Submit messages to Message Queue.
2. Along with that I need to Clientby mentioning EndPoint Name
3. And a Service function which reads messages from Queue

Instead of using Svcutil.exe I would like to go for Service Reference.

Any help would be greatly appreciated.
Regards, Praveen
Praveen Chellaboina
Hi Praveen,

The sample you mentioned(in windows SDK for .NET 3.5) just demonstrate how to use the WCF netMsmqBinding to let a client application send MSMQ message via WCF programming interface. Andif youuse netMSMQbinding, all the underlying msmq message sending details has been hidden/encapsulated by WCFprogramming model.

And the msmqIntegrationBinding is used forcommunicatino between WCFendpoint and legacy msmqprogram. For example, the samplein following link just demonstrate using WCF client proxy to send message to to a legacy MSMQ queue(via msmqIntegrationBinding):

http://msdn.microsoft.com/en-us/library/ms789008.aspx

For your scenario, what is the actual result you want to achieve?



Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Steven Cheng - MSFT
Hi Steven,

Thanks a lot.

I want to develop atleast 5 Client applications that handles msmqIntegrationBinding. Any client can send message to Message Queue first.

WCF Service should take care of receiving messages from Message Queue, process it and send the message to other client transactionally and without duplicates.

Any client can be down at any time and Clients may reside on different systems over LAN.

I prefer to install WCF Service and MSMQ in all systems where Clients are running.

In developing WCF Service/Client, I would like to go for Service Referencerather than SvcUtil.exe

I want to write client side as

TestServiceClient client =new TestServiceClient("EndPointAddress");
client.SubmitFunction1(message1);
client.SubmitFunction2(message2);

Any help would be greatly appreciated.

Regards, Praveen
Praveen Chellaboina
Hi Praveen,

One thing here is that WCF service automatically dequeues all messages from all clients. When you are using MSMQ it is always disconnected or offline mode oc communication, so even if the client app goes down after sending message to the Q, which is published by WCF service, it will be there till WCF service dows notdqueues it.

You also mentioned that you prefer to install WCF serviceand MSMQ on all machines, for what purpose you need this. THE WCF service will be onone central machine (the server machine probably) and all other machines inLAN will have client app installed with WCF proxy. You may have MSMQ installed on each client machine, but all the client applications will reffer Q exposed by WCF service ehich is publicQ define on centralachine (generally) and configured in WCF service.

One more important thing here is thatsince communication is thriugh MSMQ so no immediate response will be send by WCF service to client so operation contract define in WCF saervice must be configured as OneWay=true this means that they does not return any value they are VOID.


Regards

Mahesh Sabnis
Mahesh Sabnis
Hi,

Just I want to know about any settings that needs to be changed to make SubmitMsmqMessage visible in accepting proper parameters at Client side.


Regards, Praveen
Praveen Chellaboina
Hi Praveen,

Have you been able to create the example you proposed to build.
if yes, can you please share the code on how you implemented that.

Cheers
Thompson
thompson3

You can use google to search for other answers

Custom Search

More Threads

• wcf service which is hosted in windows services (Xp)
• Failed to execute request because the App-Domain could not be created. Error: 0x8000ffff Catastrophic failure
• vb6/vba client accessing WCF service using MEX moniker
• Outgoing MessageHeader
• WCF client and HTTP post message body
• ENUM in WCF
• How to logg the execptions caught at WCF client side
• Using an Interface as DataMember on a DataContract
• ServiceHost.Close throws an TimeoutException
• problem with svcutil when service service takes "object" type for parameter