Domanda

So che WCF supporta molti protocolli WS- * ma WS-Eventing sembra essere elencato.

So che WCF ha un modello pub / sub, ma è conforme a WS-Eventing?

È stato utile?

Soluzione

Mi sembra di averlo letto su CodeProject qualche tempo fa.

Mi dispiace non posso aiutare di più, ma questo è l'articolo di Roman Kiss. ??

Altri suggerimenti

Almeno con WCF4 puoi semplicemente creare un client wsdl importando WS-Event WSDL (con un legame sapone). Richiede un'associazione duplex, quindi dovrebbe funzionare sia http-duplex o semplice tcp. Il problema è l'aggiunta del callback corretto. Per noi questo ha funzionato

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

Non esiste un pub / modello secondario nativo in WCF 3.0, tuttavia ci sono alcune opzioni.
- L'articolo del bacio romano che Ash ha trovato.
- Esistono molti altri schemi che è possibile implementare (trattati in MSDN Mag )
- Juval Lowy ha due implementazioni di framework che puoi scaricare sul suo sito all'indirizzo IDesign
- Infine, quello che sto usando attualmente per imitare questo con un piccolo overhead è MSMQ.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top