Does WCF support WS-Eventing?

I know that WCF supports many WS- * protocols, but WS-Eventing seems to be listed.

I know WCF has a pub / submodule, but is compatible with WS-Eventing?

+3
source share
3 answers

It seems I have not read about this for a long time on CodeProject.

Sorry, I can’t help anymore, but this is an article by Roman Kiss.

+3
source

At least with WCF4, you can simply create a wsdl client by importing WSD-WS-WSDL (with soap binding). This requires duplex binding to work with both http-duplex and simple tcp. The problem is adding the correct callback. For us it 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);
                        }
+1
source

WCF 3.0 does not have a native pub / sub model, however there are several options.
- Found an article of a Roman kiss. - There are many other templates that you could implement (in MSDN Mag )
- Juval Lowy has two wireframe versions that you can download on your website at IDesign
- Finally, what I am currently using to simulate this With little overhead, this is MSMQ.

0
source

Source: https://habr.com/ru/post/1697251/


All Articles