Example #1
0
 /// <summary>
 /// Receives an input message containing XML data in a stream.
 /// </summary>
 /// <param name="message">XML message content in a stream</param>
 /// <param name="endpointName">input endpoint name; can be null</param>
 /// <param name="metadata">metadata about the input message; can be null</param>
 /// <param name="context">arbitrary context which should be retained
 /// until a possible reply; can be null</param>
 /// <param name="resultHandler">action to be performed with the reply
 /// message when the token processing has been finished</param>
 protected void ReceiveMessageXml(
     Stream messageStream,
     string endpointName,
     XDocument metadata,
     object context,
     MessageResultHandler resultHandler)
 {
     try
     {
         XDocument xDoc = XDocument.Load(messageStream, LoadOptions.SetLineInfo);
         this.ReceiveMessageXml(xDoc, endpointName, metadata, context, resultHandler);
     }
     catch (Exception e)
     {
         TraceLog.Exception(e);
     }
 }
Example #2
0
        /// <summary>
        /// Receives an input message containing XML data in an XDocument.
        /// </summary>
        /// <remarks>
        /// This method is asynchronous and can simulate synchronous
        /// communication. The reply is send back from within a given result
        /// handler and a context is preseved.
        /// </remarks>
        /// <param name="message">XML message content in an XDocument</param>
        /// <param name="endpointName">input endpoint name; can be null</param>
        /// <param name="metadata">metadata about the input message; can be null</param>
        /// <param name="context">arbitrary context which should be retained
        /// until a possible reply; can be null</param>
        /// <param name="resultHandler">action to be performed with the reply
        /// message when the token processing has been finished</param>
        protected void ReceiveMessageXml(
            XDocument message,
            string endpointName,
            XDocument metadata,
            object context,
            MessageResultHandler resultHandler)
        {
            Token token = new Token();

            token.IsPersistent = AreInputTokensPersistent;
            token.SetSourceAddress(new EndpointAddress(Gateway.Name, AdapterName, endpointName));
            token.SaveSourceMetadata(metadata);
            token.AddMessage(Constants.InputMessageName, message);
            TraceLog.Info("Created token with GUID " + token.Guid);
            Gateway.ReceiveToken(token, context, resultHandler);
        }
        public IAsyncResult BeginUpdateScriptingApplicationToWebStore(WebStoreRequestMessage message, MessageResultHandler callback, object state)
        {
            SoapEnvelope envelope = new SoapEnvelope();
            envelope.Context.Security.Tokens.AddRange(_security.Tokens);
            envelope.SetBodyObject(message);

            _clientHandler = callback;
            return base.BeginSendRequestResponse("UpdateScriptingApplicationToWebStore",envelope,new AsyncCallback(EndMessageResultHandler),typeof(WebStoreResultMessage));
        }
Example #4
0
 /// <summary>
 /// Receives an input message containing some plain-text data.
 /// </summary>
 /// <param name="message">plain-text message content</param>
 /// <param name="endpointName">input endpoint name; can be null</param>
 /// <param name="metadata">metadata about the input message; can be null</param>
 /// <param name="context">arbitrary context which should be retained
 /// until a possible reply; can be null</param>
 /// <param name="resultHandler">action to be performed with the reply
 /// message when the token processing has been finished</param>
 protected void ReceiveMessageData(
     string message,
     string endpointName,
     XDocument metadata,
     object context,
     MessageResultHandler resultHandler)
 {
     XDocument xDoc = new XDocument();
     xDoc.Add(new XElement(XName.Get("data"))
     {
         Value = message
     });
     this.ReceiveMessageXml(xDoc, endpointName, metadata, context, resultHandler);
 }
        public IAsyncResult BeginGetUserDetails(MessageResultHandler callback, object state)
        {
            SoapEnvelope envelope = new SoapEnvelope();
            envelope.Context.Security.Tokens.AddRange(_security.Tokens);
            ServiceContext message = new ServiceContext();
            message.SessionID = this.currentSessionId;
            envelope.SetBodyObject(message);

            _clientHandler = callback;
            return base.BeginSendRequestResponse("GetUserDetails",envelope,new AsyncCallback(EndMessageResultHandler),typeof(AccountMessage));
        }
        public IAsyncResult BeginCreateAccount(AccountMessage message, MessageResultHandler callback, object state)
        {
            message.SessionID = this.currentSessionId;

            SoapEnvelope envelope = new SoapEnvelope();
            envelope.Context.Security.Tokens.AddRange(_security.Tokens);
            envelope.Body.InnerXml = EncryptAccountMessage(message);
            // envelope.SetBodyObject(message);

            _clientHandler = callback;
            return base.BeginSendRequestResponse("CreateAccount",envelope,new AsyncCallback(EndMessageResultHandler),typeof(AccountMessage));
        }
        /// <summary>
        /// Publish a scripting application to a web store.
        /// </summary>
        private void PublishApplication()
        {
            _selectedApplicationFilePath =
                GetSelectedApplicationFilePath();

            LicenseServiceClient client = Utils.ServicesProxy.GetClientProxy();

            ScriptingApplicationMetadataDialog publishDialog = new ScriptingApplicationMetadataDialog();

            if ( publishDialog.ShowDialog() == DialogResult.OK )
            {
                WebStoreRequestMessage message = new WebStoreRequestMessage();

            //				ScriptingApplicationPackage package = new ScriptingApplicationPackage();
            //				package.OpenPackage(_selectedApplicationFilePath);
            //				ScriptingApplicationPackage.CreatePackage(package.ScriptingApplication, package.ScriptingApplicationArguments, "

                message.ApplicationData = Utils.ServicesProxy.ReadFileToBase64String(_selectedApplicationFilePath);
                message.ApplicationID = ScriptingApplicationPackage.ReadApplicationID(_selectedApplicationFilePath);
                message.ApplicationName = publishDialog.ApplicationName;
                message.Description = publishDialog.Description;
                message.Keywords = publishDialog.Keywords;
                message.Rating = 0;

                MessageResultHandler callback = new MessageResultHandler(UpdateScriptingApplicationResultInvoker);
                client.BeginUpdateScriptingApplicationToWebStore(message, callback, null);
                StartProgress("Uploading Scripting Application...Please wait");
            }
        }
Example #8
0
 public ResultHandlingInfo(Guid tokenGuid, MessageResultHandler resultHandler, object context)
 {
     TokenGuid = tokenGuid;
     ResultHandler = resultHandler;
     Context = context;
 }
Example #9
0
 internal void ReceiveToken(Token token, object context, MessageResultHandler resultHandler = null)
 {
     if (resultHandler != null)
     {
         ResultHandlingInfo resultHandlingInfo = new ResultHandlingInfo(token.Guid, resultHandler, context);
         waitingResultMessageHandlers.AddOrUpdate(token.Guid, resultHandlingInfo, (key, oldValue) => resultHandlingInfo);
     }
     Broker.ReceiveToken(token);
 }