コード例 #1
0
        public override XdsResponseDocument ExecuteXmlDataManager(XdsRequestDocument requestDocument)
        {
            var adapter      = XmlDataTool.ResolveXmlDataManagerAdapter(ProductName);
            var requestBytes = adapter.RequestSerializer.Serialize(requestDocument);

            using (var xdsProxy = new XmlDataServiceClient()) {
                var ar = xdsProxy.BeginExecute(requestBytes, ProductName, false, null, null);
                Thread.Sleep(1);
                var responseBytes = xdsProxy.EndExecute(ar);
                return(adapter.ResponseSerializer.Deserialize(responseBytes));
            }
        }
コード例 #2
0
        private static void VerifyXmlDataServiceAsync(XdsRequestDocument xdsRequest, string productName, bool?compress,
                                                      bool?security)
        {
            var waitHandle   = new AutoResetEvent(false);
            var serializer   = GetSerializer(compress, security);
            var requestBytes = serializer.Serialize(xdsRequest.ConvertToBytes());

            var proxy = new XmlDataServiceClient();

            if (security.GetValueOrDefault(false))
            {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecuteSecurity(requestBytes, productName, compress.GetValueOrDefault(false),
                                           (ar) => {
                    var proxy2        = (XmlDataServiceClient)ar.AsyncState;
                    var responseBytes = proxy2.EndExecuteSecurity(ar);
                    var xdsResponse   =
                        ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                    Assert.IsNotNull(xdsResponse);
                    Assert.IsFalse(xdsResponse.HasError);
                    Assert.IsTrue(xdsResponse.Responses.Count > 0);
                    proxy2.Close();
                },
                                           proxy);
            }
            else
            {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecute(requestBytes, productName, compress.GetValueOrDefault(false),
                                   (ar) => {
                    var proxy2        = (XmlDataServiceClient)ar.AsyncState;
                    var responseBytes = proxy2.EndExecute(ar);
                    var xdsResponse   =
                        ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                    Assert.IsNotNull(xdsResponse);
                    Assert.IsFalse(xdsResponse.HasError);
                    Assert.IsTrue(xdsResponse.Responses.Count > 0);
                    proxy2.Close();
                },
                                   proxy);
            }
        }
コード例 #3
0
        private static void VerifyXmlDataServiceAsync(XdsRequestDocument xdsRequest, string productName, bool? compress,
                                                      bool? security) {
            var waitHandle = new AutoResetEvent(false);
            var serializer = GetSerializer(compress, security);
            var requestBytes = serializer.Serialize(xdsRequest.ConvertToBytes());

            var proxy = new XmlDataServiceClient();

            if(security.GetValueOrDefault(false)) {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecuteSecurity(requestBytes, productName, compress.GetValueOrDefault(false),
                                           (ar) => {
                                               var proxy2 = (XmlDataServiceClient)ar.AsyncState;
                                               var responseBytes = proxy2.EndExecuteSecurity(ar);
                                               var xdsResponse =
                                                   ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                                               Assert.IsNotNull(xdsResponse);
                                               Assert.IsFalse(xdsResponse.HasError);
                                               Assert.IsTrue(xdsResponse.Responses.Count > 0);
                                               proxy2.Close();
                                           },
                                           proxy);
            }
            else {
                // IAsyncResult를 반환받아서 필요할 때 기다리게 할 수도 있지만, 테스트를 위해 Synchronous하게 동작하게 한다.
                proxy.BeginExecute(requestBytes, productName, compress.GetValueOrDefault(false),
                                   (ar) => {
                                       var proxy2 = (XmlDataServiceClient)ar.AsyncState;
                                       var responseBytes = proxy2.EndExecute(ar);
                                       var xdsResponse =
                                           ((byte[])serializer.Deserialize(responseBytes)).ConvertToXdsResponseDocument();

                                       Assert.IsNotNull(xdsResponse);
                                       Assert.IsFalse(xdsResponse.HasError);
                                       Assert.IsTrue(xdsResponse.Responses.Count > 0);
                                       proxy2.Close();
                                   },
                                   proxy);
            }
        }
コード例 #4
0
        public override XdsResponseDocument ExecuteXmlDataManager(XdsRequestDocument requestDocument) {
            var adapter = XmlDataTool.ResolveXmlDataManagerAdapter(ProductName);
            var requestBytes = adapter.RequestSerializer.Serialize(requestDocument);

            using(var xdsProxy = new XmlDataServiceClient()) {
                var ar = xdsProxy.BeginExecute(requestBytes, ProductName, false, null, null);
                Thread.Sleep(1);
                var responseBytes = xdsProxy.EndExecute(ar);
                return adapter.ResponseSerializer.Deserialize(responseBytes);
            }
        }