Pregunta

Sé que WCF admite muchos protocolos WS-*, pero WS-Eventing parece estar en la lista.

Sé que WCF tiene un modelo pub/sub, pero ¿es compatible con WS-Eventing?

¿Fue útil?

Solución

Creo recordar haber leído sobre esto en CodeProject hace un tiempo.

Lo siento, no puedo ayudar más, pero este es el articulo por beso romano.

Otros consejos

Al menos con WCF4 puede simplemente crear un cliente wsdl importando el WSDL WS-Eventing (con un enlace SOAP).Requiere un enlace dúplex, por lo que http-duplex o tcp simple deberían funcionar.El problema es agregar la devolución de llamada correcta.Para nosotros esto funcionó

                            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);
                        }

No existe un modelo de publicación/subscripción nativo en WCF 3.0, sin embargo, hay algunas opciones.
- El artículo de Roman Kiss que encontró Ash.
- Hay muchos otros patrones que podrías implementar (cubiertos en Revista MSDN)
- Juval Lowy tiene dos implementaciones de marco que puedes descargar en su sitio en Yo diseño
- Por último, lo que estoy usando actualmente para imitar esto con pocos gastos generales es MSMQ.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top