Pergunta

Eu sei WCF suporta vários protocolos WS- *, mas WS-Eventing parece ser listados.

Eu sei que a WCF tem um modelo de pub / sub, mas é WS-Eventing compatível?

Foi útil?

Solução

Eu me lembro de ler sobre isso em CodeProject um tempo atrás.

Desculpe, não posso ajudar mais, mas este é o artigo por Roman Kiss. ??

Outras dicas

Pelo menos com WCF4 você pode simplesmente criar um cliente wsdl importando o WS-Eventing WSDL (com ligação de um sabão). Ela exige uma ligação de modo http-duplex ou tcp simples deve funcionar duplex. O problema é adicionar o retorno correto. Para nós, isso fez o truque

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

Não há sub modelo pub nativa / em WCF 3.0, no entanto, existem algumas opções.
- O artigo Beijo Roman Ash encontrou
. - Há um monte de outros padrões que você pode implementar (coberta no MSDN Mag )
- Juval Lowy tem duas implementações quadro você pode baixar em seu site em IDesign
- Finalmente o que eu estou usando atualmente para imitar isso com pouca sobrecarga é MSMQ.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top