문제

WCF가 많은 WS-* 프로토콜을 지원한다는 것을 알고 있지만 WS-Eventing은 목록에 없는 것 같습니다.

WCF에 게시/구독 모델이 있다는 것은 알고 있지만 WS-Eventing과 호환됩니까?

도움이 되었습니까?

해결책

얼마 전 CodeProject에서 이에 대해 읽은 기억이 나는 것 같습니다.

죄송합니다. 더 도와드릴 수는 없지만 이게 기사야 로만 키스.

다른 팁

적어도 WCF4를 사용하면 WS-Eventing WSDL(soap 바인딩 사용)을 가져와 간단히 wsdl 클라이언트를 만들 수 있습니다.이중 바인딩이 필요하므로 http-duplex 또는 단순 tcp가 작동해야 합니다.문제는 올바른 콜백을 추가하는 것입니다.우리에게는 이것이 트릭이었습니다

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

WCF 3.0에는 기본 게시/구독 모델이 없지만 몇 가지 옵션이 있습니다.
- Ash가 발견한 Roman Kiss 기사.
- 구현할 수 있는 다른 패턴이 많이 있습니다. MSDN 매거진)
- Juval Lowy의 사이트에서 다운로드할 수 있는 두 가지 프레임워크 구현이 있습니다. 아이디자인
- 마지막으로 제가 현재 약간의 오버헤드로 이를 모방하기 위해 사용하고 있는 것은 MSMQ입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top