当前位置: 首页>>代码示例>>C#>>正文


C# IncomingMessage.GetPayload方法代码示例

本文整理汇总了C#中IncomingMessage.GetPayload方法的典型用法代码示例。如果您正苦于以下问题:C# IncomingMessage.GetPayload方法的具体用法?C# IncomingMessage.GetPayload怎么用?C# IncomingMessage.GetPayload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IncomingMessage的用法示例。


在下文中一共展示了IncomingMessage.GetPayload方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Subscribe

        private OutgoingMessage Subscribe(IncomingMessage requestMessage)
        {
            var toHeader = requestMessage.GetHeader<ToHeader>();
            var subscriptionManagerReference = new EndpointReference(toHeader.Uri);
            var request = requestMessage.GetPayload<SubscribeRequest>();            
            var responseMessage = new OutgoingMessage()
                .AddHeader(new ActionHeader(Constants.SubscribeResponseAction), false);

            var expiration = CalculateExpiration(request.Expires);
            var filterInstance = GetFilterInstance(request);
            var identifier = GenerateUniqueSubscriptionIdentifier();
            var subscription = new Subscription(expiration, _requestHandler, filterInstance, subscriptionManagerReference, requestMessage);
            _activeSubscriptions.Add(identifier, subscription);
            OnSubscribed(identifier, subscription);

            //R7.2.4-1
            var body = new SubscribeResponse
                           {
                               SubscriptionManager = subscriptionManagerReference,
                               EnumerationContext = request.Delivery.Mode == Delivery.DeliveryModePull
                                                        ? new EnumerationContextKey(
                                                              identifier)
                                                        : null,
                               Expires = expiration
                           };
            responseMessage.SetBody(new SerializerBodyWriter(body));
            return responseMessage;
        }
开发者ID:SzymonPobiega,项目名称:WS-Man.Net,代码行数:28,代码来源:EventingServer.cs

示例2: Pull

 private OutgoingMessage Pull(IncomingMessage requestMessage)
 {
     var response = CreatePullResponse();
     var request = requestMessage.GetPayload<PullRequest>();
     IPullHandler handler;
     var context = request.EnumerationContext.Text;
     lock (_handlers)
     {
         if (!_handlers.TryGetValue(context, out handler))
         {
             throw new InvalidEnumerationContextFaultException();
         }
     }
     var maxElements = GetMaxElements(request);
     var maxTime = GetMaxTime(request);
     var pullResult = handler.Pull(maxElements, maxTime, context);
     var items = new EnumerationItemList(pullResult.Items, pullResult.EnumerationMode);
     if (pullResult.EndOfSequence)
     {
         handler.Dispose();
         lock (_handlers)
         {
             _handlers.Remove(context);
         }
     }
     response.SetBody(
         new SerializerBodyWriter(new PullResponse
                                      {
                                          Items = items,
                                          EndOfSequence = pullResult.EndOfSequence ? new EndOfSequence() : null,
                                          EnumerationContext = pullResult.EndOfSequence ? null : request.EnumerationContext
                                      }));
     return response;
 }
开发者ID:SzymonPobiega,项目名称:WS-Man.Net,代码行数:34,代码来源:PullServer.cs

示例3: Create

 private OutgoingMessage Create(IncomingMessage createRequest)
 {
     Log.InfoFormat("Handling Create request");
     var response = _factory.CreateCreateResponse();
     var incomingHeaders = new IncomingHeaders(createRequest);
     var outgoingHeaders = new OutgoingHeaders(response);
     var reference = _handler.HandleCreate(incomingHeaders, outgoingHeaders, x => createRequest.GetPayload(x));
     response.SetBody(new CreateResponseBodyWriter(reference));
     Log.InfoFormat("Create request handled successfully");
     return response;
 }
开发者ID:SzymonPobiega,项目名称:WS-Man.Net,代码行数:11,代码来源:TransferServer.cs

示例4: Put

 private OutgoingMessage Put(IncomingMessage putRequest)
 {
     Log.InfoFormat("Handling Put request");
     var response = _factory.CreatePutResponse();
     var incomingHeaders = new IncomingHeaders(putRequest);
     var outgoingHeaders = new OutgoingHeaders(response);
     var payload = _handler.HandlePut(incomingHeaders, outgoingHeaders, x => putRequest.GetPayload(x));
     response.SetBody(new SerializerBodyWriter(payload));
     Log.InfoFormat("Put request handled successfully");
     return response;
 }
开发者ID:SzymonPobiega,项目名称:WS-Man.Net,代码行数:11,代码来源:TransferServer.cs

示例5: IsInstanceOf

        public OutgoingMessage IsInstanceOf(IncomingMessage requestMessage)
        {
            CheckResourceUri(requestMessage, Schema.DynamicMBeanResourceUri);

            var request = requestMessage.GetPayload<IsInstanceOfMessage>();
            var selectorSet = requestMessage.GetHeader<SelectorSetHeader>();
            var objectName = selectorSet.ExtractObjectName();

            //TODO: Java-to-Net class mapping (i.e. javax.management.NotificationBroadcaster)

            var result = _server.IsInstanceOf(objectName, request.Value);
            var response = new IsInstanceOfResponseMessage(result);
            return new OutgoingMessage()
                .AddHeader(new ActionHeader(Schema.InstanceOfResponseAction), true)
                .SetBody(new SerializerBodyWriter(response));
        }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:16,代码来源:Jsr262ExtensionMethodHandler.cs

示例6: Invoke

        public OutgoingMessage Invoke(IncomingMessage requestMessage)
        {
            CheckResourceUri(requestMessage, Schema.DynamicMBeanResourceUri);

            var request = requestMessage.GetPayload<InvokeMessage>();
            var selectorSet = requestMessage.GetHeader<SelectorSetHeader>();
            var objectName = selectorSet.ExtractObjectName();
            var arguments = request.ManagedResourceOperation.Input.Select(x => x.Deserialize()).ToArray();

            var result = _server.Invoke(objectName, request.ManagedResourceOperation.name, arguments);

            var response = new InvokeResponseMessage(new GenericValueType(result));
            return new OutgoingMessage()
                .AddHeader(new ActionHeader(Schema.InvokeResponseAction), true)
                .SetBody(new SerializerBodyWriter(response));
        }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:16,代码来源:Jsr262ExtensionMethodHandler.cs

示例7: Enumerate

        private OutgoingMessage Enumerate(IncomingMessage requestMessage)
        {
            var request = requestMessage.GetPayload<EnumerateRequest>();
            var contextKey = EnumerationContextKey.Unique();
            var filter = CreateFilterInstance(request.Filter);
            var context = new EnumerationContext(contextKey.Text, filter);

            if (IsCountRequest(requestMessage))
            {
                return HandleCountEnumerate(requestMessage, contextKey, request, context);
            }
            if (request.OptimizeEnumeration != null)
            {
                return HandleOptimizedEnumerate(requestMessage, contextKey, request, context);
            }
            return HandleNormalEnumerate(requestMessage, contextKey, request, context);
        }
开发者ID:SzymonPobiega,项目名称:WS-Man.Net,代码行数:17,代码来源:EnumerationServer.cs

示例8: Renew

        public OutgoingMessage Renew(IncomingMessage requestMessage)
        {            
            var request = requestMessage.GetPayload<RenewRequest>();
            var identifierHeader = requestMessage.GetHeader<IdentifierHeader>();
            

            var existing = _activeSubscriptions.Get(identifierHeader.Identifier);
            existing.Renew(CalculateExpiration(request.Expires));

            var responseMessage = new OutgoingMessage()
                .AddHeader(new ActionHeader(Constants.RenewResponseAction), false);
            responseMessage.SetBody(new SerializerBodyWriter(
                                        new RenewResponse
                                            {
                                                Expires = request.Expires
                                            }));
            return responseMessage;
        }
开发者ID:SzymonPobiega,项目名称:WS-Man.Net,代码行数:18,代码来源:EventingServer.cs


注:本文中的IncomingMessage.GetPayload方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。