Question

I know WCF supports many WS-* protocols but WS-Eventing does seem to be listed.

I do know that WCF has a pub/sub model, but is it WS-Eventing compliant?

Was it helpful?

Solution

I seem to remember reading about this on CodeProject a while ago.

Sorry I can't help more, but this is the article by Roman Kiss.

OTHER TIPS

At least with WCF4 you can simply create a wsdl client by importing the WS-Eventing WSDL (with a soap binding). It requires a duplex binding so either http-duplex or simple tcp should work. The problem is adding the correct callback. For us this did the trick

                            Subscribe s = new Subscribe();
                        (s.Delivery = new DeliveryType()).Mode = "http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push";

                        XmlDocument doc = new XmlDocument();
                        using (XmlWriter writer = doc.CreateNavigator().AppendChild())
                        {
                            EndpointReferenceType notifyTo = new EndpointReferenceType();

                            (notifyTo.Address = new AttributedURI()).Value = callbackEndpoint.Uri.AbsoluteUri;

                            XmlRootAttribute notifyToElem = new XmlRootAttribute("NotifyTo");
                            notifyToElem.Namespace = "http://schemas.xmlsoap.org/ws/2004/08/eventing";

                            XmlDocument doc2 = new XmlDocument();                                    
                            using (XmlWriter writer2 = doc2.CreateNavigator().AppendChild())
                            {
                                XmlRootAttribute ReferenceElement = new XmlRootAttribute("ReferenceElement");
                                foreach(AddressHeader h in callbackEndpoint.Headers)
                                {
                                    h.WriteAddressHeader(writer2);  
                                }

                                writer2.Close();
                                notifyTo.ReferenceParameters = new ReferenceParametersType();
                                notifyTo.ReferenceParameters.Any = notifyTo.ReferenceParameters.Any = doc2.ChildNodes.Cast<XmlElement>().ToArray<XmlElement>();               
                            }

                            new XmlSerializer(notifyTo.GetType(), notifyToElem).Serialize(writer, notifyTo);
                        }

                        (s.Delivery.Any = new XmlElement[1])[0] = doc.DocumentElement;
                        (s.Filter = new FilterType()).Dialect = "http://schemas.xmlsoap.org/ws/2006/02/devprof/Action";
                        (s.Filter.Any = new System.Xml.XmlNode[1])[0] = new System.Xml.XmlDocument().CreateTextNode("http://www.teco.edu/SensorValues/SensorValuesEventOut");

                        SubscribeResponse subscription;
                        try
                        {
                            Console.WriteLine("Subscribing to the event...");
                            //Console.ReadLine();
                            subscription = eventSource.SubscribeOp(s);
                        }

There is no native pub/sub model in WCF 3.0, however there are a few options.
- The Roman Kiss article Ash found.
- There is a lot of other patterns you could implement (covered in MSDN Mag)
- Juval Lowy has two framework implementations you can download on his site at IDesign
- Lastly what I am using currently to mimic this with little overhead is MSMQ.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top