コード例 #1
0
            public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
            {
                Console.WriteLine("IClientMessageInspector BeforeSendRequest:\n{0}", request.ToString());
                MessageHeader hdUserName = MessageHeader.CreateHeader("u", "username", "admin");
                MessageHeader hdPassWord = MessageHeader.CreateHeader("p", "password", "123");

                request.Headers.Add(hdUserName);
                request.Headers.Add(hdPassWord);
                Console.WriteLine("IClientMessageInspector BeforeSendRequest:\n{0}", request.ToString());
                return(null);
            }
コード例 #2
0
            public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
            {
                if (correlationState != null &&
                    String.Equals(correlationState, _correlationState) &&
                    !reply.ToString().Contains("<soapenv:Fault>"))
                {
                    var memoryStream = new MemoryStream();
                    var writer       = XmlWriter.Create(memoryStream);
                    reply.WriteMessage(writer);
                    writer.Flush();

                    memoryStream.Position = 0;
                    var doc = new XmlDocument();
                    doc.Load(memoryStream);

                    UpdateMessage(doc);

                    memoryStream.SetLength(0);
                    writer = XmlWriter.Create(memoryStream);
                    doc.WriteTo(writer);
                    writer.Flush();

                    memoryStream.Position = 0;
                    var reader = XmlReader.Create(memoryStream);
                    reply = Message.CreateMessage(reader, int.MaxValue, reply.Version);
                }
            }
コード例 #3
0
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            if (!_traceSoapMessages && !_traceSoapMessageHeaders)
            {
                return(null);
            }
            StringBuilder logMessageHeader = new StringBuilder();

            logMessageHeader.AppendLine("Sending Request:");
            logMessageHeader.AppendLine();
            if (_traceSoapMessageHeaders)
            {
                foreach (MessageHeader header in request.Headers)
                {
                    string headerString = header.ToString();
                    logMessageHeader.AppendLine(headerString);
                }
            }
            StringBuilder logMessageMessages = new StringBuilder();

            if (_traceSoapMessages)
            {
                string soapMessage = request.ToString();
                logMessageMessages.AppendLine(soapMessage);
            }
            string logMessageHeaderString   = logMessageHeader.ToString();
            string logMessageMessagesString = logMessageMessages.ToString();

            GOCWindows.Instance.Logger.LogMessage(new LogMessage(logMessageHeaderString, LogMessageType.Information, LoggingLevel.Maximum));
            return(null);
        }
コード例 #4
0
        public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
        {
            string ModuleName = "AUBMessageInspector";
            string MethodName = "AfterReceiveReply";

            string replyString = reply.ToString();
            string sessionID   = (string)correlationState;

            NCR.EAI.Log.MessageLogger msgLogger = new NCR.EAI.Log.MessageLogger();
            MessageLog _messageLog = new MessageLog();

            _messageLog.IN_OUT     = MessageLog.INOUT.OUT_RES.GetHashCode();
            _messageLog.SESSION_ID = sessionID;
            _messageLog.NETWORK_ID = ConfigurationManager.AppSettings["AUB_OIS_NETWORK_ID"].ToString();

            msgLogger.updateSoapResponseMsgLog(ref reply, ref _messageLog);

            //throw new NotImplementedException();
            //System.Windows.Forms.MessageBox.Show(reply.WriteMessage()
            if (Convert.ToBoolean(ConfigurationManager.AppSettings["LOG_AUB_MESSAGE"].ToString()))
            {
                string pattern  = @"\b(?:(4|5)([0-9]{1})([0-9]{4})([0-9]{6})([0-9]{4}))\b";
                string MASKCARD = "$1$2$3******$5";
                string DebugMsg = Regex.Replace(replyString, pattern, MASKCARD);

                Logger.logDebug(ModuleName, MethodName, "Reply Message: " + DebugMsg, Logger.LOGLEVEL.INFO);
            }
            try
            {
                Logger.logDebug(ModuleName, MethodName, "Is Fault: " + reply.IsFault.ToString(), Logger.LOGLEVEL.INFO);
            }
            catch
            {
            }
        }
コード例 #5
0
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            string remAddress = "";

            try
            {
                remAddress = channel.RemoteAddress.Uri.ToString();
            }
            catch
            {
            }
            //request.Headers.To = "http://";
            //throw new NotImplementedException();
            //string luserName = "******";
            //string lPassword = "******";

            string ModuleName = "AUBMessageInspector";
            string MethodName = "BeforeSendingRequest";

            string requestString = request.ToString();

            //MessageBuffer requestMessage = request.CreateBufferedCopy(Int32.MaxValue);
            //request = requestMessage.CreateMessage();
            if (Convert.ToBoolean(ConfigurationManager.AppSettings["LOG_AUB_MESSAGE"].ToString()))
            {
                string pattern  = @"\b(?:(4|5)([0-9]{1})([0-9]{4})([0-9]{6})([0-9]{4}))\b";
                string MASKCARD = "$1$2$3******$5";
                string DebugMsg = Regex.Replace(requestString, pattern, MASKCARD);

                Logger.logDebug(ModuleName, MethodName, "Request Message: " + DebugMsg, Logger.LOGLEVEL.INFO);
            }
            string sessionID = Guid.NewGuid().ToString();// channel.SessionId.ToString();

            NCR.EAI.Log.MessageLogger msgLogger = new NCR.EAI.Log.MessageLogger();

            MessageLog _messageLog = new MessageLog();

            string messageID = "";

            try
            {
                messageID = OperationContext.Current.IncomingMessageProperties["MESSAGEID"].ToString();
            }
            catch (Exception ex)
            {
                messageID = sessionID;
            }
            _messageLog.CORRELATION_ID = messageID;
            _messageLog.SESSION_ID     = sessionID;
            _messageLog.IN_OUT         = MessageLog.INOUT.OUT_REQ.GetHashCode();
            _messageLog.ADDRESS        = remAddress;

            msgLogger.addSoapRequesttoMsgLog(ref request, _messageLog, channel);


            return(sessionID);
        }
コード例 #6
0
 public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     foreach (IListener listener in _listeners)
     {
         listener.WriteLine("IClientMessageInspector.AfterReceiveReply called.", InformationType.Service);
         listener.WriteLine("Message:", InformationType.Service);
         listener.WriteLine(reply.ToString(), InformationType.Response);
     }
 }
コード例 #7
0
 public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel)
 {
     foreach (IListener listener in _listeners)
     {
         listener.WriteLine("IClientMessageInspector.BeforeSendRequest called.", InformationType.Service);
         listener.WriteLine("Message: ", InformationType.Service);
         listener.WriteLine(request.ToString(), InformationType.Request);
     }
     return(null);
 }
コード例 #8
0
        protected virtual void InspectRequestMessage(ref System.ServiceModel.Channels.Message request,
                                                     System.ServiceModel.IClientChannel channel,
                                                     System.ServiceModel.InstanceContext instanceContext)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "LogReceiveRequest");

            try
            {
                if (this.LogRequestMessage)
                {
                    this.OnLogRequestMessage(PROC, request.ToString());
                }

                // process the message
                try
                {
                    OperationContext      context = null;
                    OperationContextScope scope   = null;

                    if (this.NeedOperationContext &&
                        OperationContext.Current != null)
                    {
                        context = OperationContext.Current;
                    }

                    try
                    {
                        if (this.NeedOperationContext &&
                            context == null)
                        {
                            scope   = new OperationContextScope(channel);
                            context = OperationContext.Current;
                        }

                        this.OnProcessRequestMessage(ref request, channel, instanceContext, context);
                    }
                    finally
                    {
                        if (scope != null)
                        {
                            scope.Dispose();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Log.Exception(PROC, ex);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
コード例 #9
0
 /// <summary>
 /// Called after an inbound message has been received but
 /// before the message is dispatched to the intended operation.
 ///
 /// This method will also raise RaiseRequestReceived event.
 /// </summary>
 /// <param name="request">The request message.</param>
 /// <param name="channel">The incoming channel.</param>
 /// <param name="instanceContext">The current service instance.</param>
 /// <returns>
 /// The object used to correlate state.
 /// </returns>
 public object AfterReceiveRequest(
     ref System.ServiceModel.Channels.Message request,
     System.ServiceModel.IClientChannel channel,
     System.ServiceModel.InstanceContext instanceContext)
 {
     if (request != null)
     {
         Request = request.ToString();
     }
     OnRaiseRequestReceived(Request);
     return(null);
 }
コード例 #10
0
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            var soapAction = request.Headers.Action;
            XmlDictionaryReader bodyReader  = request.GetReaderAtBodyContents();
            var             soapXml         = bodyReader.ReadOuterXml();
            DafV4BodyWriter newBody         = new DafV4BodyWriter(soapXml);
            Message         replacedMessage = Message.CreateMessage(request.Version, soapAction, newBody);

            replacedMessage.Properties.CopyProperties(request.Properties);
            request        = replacedMessage;
            LastRequestXML = request.ToString();
            return(request);
        }
コード例 #11
0
 /// <summary>
 /// Called after the operation has returned but before the reply message is sent.
 ///
 /// This method will also raise RaiseSendReply event.
 /// </summary>
 /// <param name="reply">The reply message.
 /// This value is null if the operation is one way.</param>
 /// <param name="correlationState">The correlation object returned from the
 /// AfterReceiveRequest method.</param>
 public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply,
                             object correlationState)
 {
     if (reply != null)
     {
         Response = reply.ToString();
     }
     OnRaiseSendingReply(Response);
     if (reply != null && reply.IsFault)
     {
         Diagnostics.Error(
             string.Format("Outgoing SOAP fault detected:\r\n{0}\r\n\r\nOriginal incoming request:\r\n{1}", Response, Request));
     }
 }
コード例 #12
0
        /// <summary>
        /// Implementation will add the headers for MS-WOPI before a request message is sent to a service.
        /// </summary>
        /// <param name="request">Specify the message to be sent to the service.</param>
        /// <param name="channel">Specify the client object channel.</param>
        /// <returns>Return null.</returns>
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            // Restore the request.
            string      requestString = request.ToString();
            XmlDocument requestXml    = new XmlDocument();

            requestXml.LoadXml(requestString);
            SchemaValidation.LastRawRequestXml = requestXml.DocumentElement;

            // Create a clone message for the request.
            MessageBuffer messageBuffer = request.CreateBufferedCopy(int.MaxValue);

            request = messageBuffer.CreateMessage();

            if (this.context.OperationType == OperationType.WOPICellStorageRequest ||
                this.context.OperationType == OperationType.WOPICellStorageRelativeRequest)
            {
                // Remove the SoapAction header
                request.Headers.RemoveAll("Action", "http://schemas.microsoft.com/ws/2005/05/addressing/none");

                // Add all the MUST header values
                this.AddHeader(ref request, "X-WOPI-Proof", this.context.XWOPIProof);
                this.AddHeader(ref request, "X-WOPI-TimeStamp", this.context.XWOPITimeStamp);
                this.AddHeader(ref request, "Authorization", this.context.XWOPIAuthorization);

                // Add all the optional value
                if (this.context.IsXWOPIOverrideSpecified)
                {
                    this.AddHeader(ref request, "X-WOPI-Override", this.context.GetValueOrDefault <string>("X-WOPI-Override", "COBALT"));
                }

                if (this.context.IsXWOPISizeSpecified)
                {
                    this.AddHeader(ref request, "X-WOPI-Size", this.context.GetValueOrDefault <int>("X-WOPI-Size", this.SizeOfWOPIMessage(messageBuffer.CreateMessage())).ToString());
                }

                if (this.context.OperationType == OperationType.WOPICellStorageRelativeRequest)
                {
                    if (this.context.IsXWOPIRelativeTargetSpecified)
                    {
                        this.AddHeader(ref request, "X-WOPI-RelativeTarget", this.context.XWOPIRelativeTarget);
                    }
                }
            }

            return(null);
        }
コード例 #13
0
        private string GetRequestMessageTextWithHeaders(System.ServiceModel.Channels.Message request)
        {
            string message = string.Empty;

            HttpRequestMessageProperty httpRequest = (HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name];

            message = httpRequest.Method + " " + request.Headers.To.PathAndQuery + " HTTP/1.1" + Environment.NewLine;

            foreach (var header in httpRequest.Headers)
            {
                message += header.ToString() + ": " + httpRequest.Headers.Get(header.ToString()) + Environment.NewLine;
            }

            message += Environment.NewLine;
            message += request.ToString();

            return(message);
        }
コード例 #14
0
        public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
        {
            StringBuilder logMessage = new StringBuilder();

            logMessage.AppendLine("Received Reply:");
            logMessage.AppendLine();
            if (_traceSoapMessageHeaders)
            {
                foreach (MessageHeader header in reply.Headers)
                {
                    string headerString = header.ToString();
                    logMessage.AppendLine(headerString);
                }
            }
            if (_traceSoapMessages)
            {
                logMessage.AppendLine();
                string soapMessage = reply.ToString();
                logMessage.AppendLine(soapMessage);
            }
            string logMessageString = logMessage.ToString();

            if (logMessageString.Contains("SOAP:Fault"))
            {
                if (logMessageString.Contains("CPAChannelStoppedException"))
                {
                    GOCWindows.Instance.Logger.LogMessage(new LogMessage(string.Format("Sap Service Offline: {0}", logMessageString), LogMessageType.Error, LoggingLevel.Normal));
                }
                else
                {
                    GOCWindows.Instance.Logger.LogMessage(new LogMessage(string.Format("Sap Error: {0}", logMessageString), LogMessageType.Error, LoggingLevel.Normal));
                }
            }
            else if (!_traceSoapMessages && !_traceSoapMessageHeaders)
            {
                return;
            }
            else
            {
                GOCWindows.Instance.Logger.LogMessage(new LogMessage(logMessageString, LogMessageType.Information, LoggingLevel.Maximum));
            }
        }
コード例 #15
0
            public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
            {
                //HttpRequestMessageProperty property = new HttpRequestMessageProperty();

                //var userAgent = "MyUserAgent/1.0.0.0";

                //if (request.Properties.Count == 0 || request.Properties[HttpRequestMessageProperty.Name] == null)
                //{
                //    var property = new HttpRequestMessageProperty();
                //    property.Headers["User-Agent"] = userAgent;
                //    request.Properties.Add(HttpRequestMessageProperty.Name, property);
                //}
                //else
                //{
                //    ((HttpRequestMessageProperty)request.Properties[HttpRequestMessageProperty.Name]).Headers["User-Agent"] = userAgent;
                //}

                LastRequestXML = request.ToString();
                return(request);
            }
コード例 #16
0
        public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
        {
            MessageBuffer buffer = reply.CreateBufferedCopy(int.MaxValue);
            Message       copy   = buffer.CreateMessage();

            var logger      = Log4NetLogger.Configure();
            var replyString = reply.ToString();

            logger.Information(replyString);
            ReportingService.LogUserActivity(replyString, LogTypes.BankLink);

            var doc = GetDocumentFromMessage(copy);

            if (!VerifySignature(doc))
            {
                throw new SignatureException("Signature is not valid");
            }

            reply = buffer.CreateMessage();
        }
コード例 #17
0
        void IDispatchMessageInspector.BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "BeforeSendReply");

            try
            {
                if (this.LogResponseMessage)
                {
                    string message = string.Empty;
                    if (reply != null)
                    {
                        message = reply.ToString();
                    }
                    this.OnLogResponseMessage(PROC, message);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
コード例 #18
0
        private string GetResponseMessageTextWithHeaders(System.ServiceModel.Channels.Message response)
        {
            string message = string.Empty;

            if (response.Properties.ContainsKey(HttpResponseMessageProperty.Name))
            {
                HttpResponseMessageProperty httpResponse = (HttpResponseMessageProperty)response.Properties[HttpResponseMessageProperty.Name];

                message = "HTTP/1.1 " + ((int)httpResponse.StatusCode).ToString() + " " + httpResponse.StatusCode.ToString() + " " + Environment.NewLine;

                foreach (var header in httpResponse.Headers)
                {
                    message += header.ToString() + ": " + httpResponse.Headers.Get(header.ToString()) + Environment.NewLine;
                }

                message += Environment.NewLine;
            }

            message += response.ToString();

            return(message);
        }
コード例 #19
0
 public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
 {
     LastRequestXML = request.ToString();
     return(request);
 }
コード例 #20
0
 public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     Debug.Print(string.Format("PasswordDigestMessageInspector AfterReceiveReply: {0}...", reply.ToString().Substring(0, 100)));
     //throw new NotImplementedException();
 }
コード例 #21
0
 public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     LastResponseXML = reply.ToString();
 }
コード例 #22
0
 public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     Console.WriteLine("客户端接收到的回复:\n{0}", reply.ToString());
 }
コード例 #23
0
 public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     Console.WriteLine("服务器即将作出以下回复:\n{0}", reply.ToString());
 }
コード例 #24
0
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            string ModuleName = "NIMessageInspector";
            string MethodName = "BeforeSendingRequest";

            string remAddress = "";

            try
            {
                remAddress = channel.RemoteAddress.Uri.ToString();

                Logger.logDebug(ModuleName, MethodName, "Remote Address : " + remAddress, Logger.LOGLEVEL.INFO);
                if (remAddress.ToUpper().StartsWith("HTTPS"))
                {
                    ApplySSL();
                }
            }
            catch
            {
            }
            //request.Headers.To = "http://";
            //throw new NotImplementedException();
            //string luserName = "******";
            //string lPassword = "******";

            //this is done for not sending the action to MDM service as the service doesnt work
            //request.Headers.SetAction(null);

            string requestString = request.ToString();

            //request = TransformMessageBody(request, true);
            //requestString = "";


            if (Convert.ToBoolean(ConfigurationManager.AppSettings["LOG_NI_MESSAGE"].ToString()))
            {
                //   Logger.logDebug(ModuleName, MethodName, "Request Message: " + requestString, Logger.LOGLEVEL.INFO);
                string pattern  = @"\b(?:(4|5)([0-9]{1})([0-9]{4})([0-9]{6})([0-9]{4}))\b";
                string MASKCARD = "$1$2$3******$5";
                string DebugMsg = Regex.Replace(requestString, pattern, MASKCARD);

                Logger.logXMLMessage(ModuleName, MethodName, DebugMsg, Logger.LOGLEVEL.INFO, true);
            }
            //string sessionID = Guid.NewGuid().ToString();// channel.SessionId.ToString();

            Utilities.Utility _utility = new Utilities.Utility();

            string sessionID = _utility.GenerateNewGUID();// channel.SessionId.ToString();

            NCR.EAI.Log.MessageLogger msgLogger = new NCR.EAI.Log.MessageLogger();

            MessageLog _messageLog = new MessageLog();

            string messageID = "";

            try
            {
                OperationContext.Current.IncomingMessageProperties.Remove("SESSIONID");
            }
            catch (Exception ex)
            {
            }

            try
            {
                OperationContext.Current.IncomingMessageProperties.Add("SESSIONID", sessionID);
            }
            catch (Exception ex)
            {
            }

            //try
            //{
            //    messageID = OperationContext.Current.IncomingMessageProperties["MESSAGEID"].ToString();
            //}
            //catch (Exception ex)
            //{
            //    messageID = sessionID;
            //}
            messageID = sessionID;
            _messageLog.CORRELATION_ID = messageID;
            _messageLog.SESSION_ID     = sessionID;
            _messageLog.IN_OUT         = MessageLog.INOUT.OUT_REQ.GetHashCode();
            _messageLog.ADDRESS        = remAddress;

            msgLogger.addSoapRequesttoMsgLog(ref request, _messageLog, channel);


            return(sessionID);
        }
コード例 #25
0
        public void ProcessMessage(System.ServiceModel.Channels.Message msg)
        {
            Trace.WriteLine("VirtualService: *** Message has been received ***");
            Trace.WriteLine(msg.ToString());

            ChannelFactory <IGenericOneWayContract> factory = null;

            try
            {
                var config = OperationContext.Current.Host.Extensions.Find <ConfigData>();
                if (config == null)
                {
                    throw new Exception("Fatal error: Missing ServiceConfigData extension object");
                }

                var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
                var se      = new ServiceEndpoint(ContractDescription.GetContract(typeof(IGenericOneWayContract)), binding, new EndpointAddress(config.TesterAddress));

                factory = new ChannelFactory <IGenericOneWayContract>(se);
                var channel = factory.CreateChannel();

                using (var msgbuffer = msg.CreateBufferedCopy(int.MaxValue))
                {
                    using (var scope = new OperationContextScope((IContextChannel)channel))
                    {
                        if (msg.Version == MessageVersion.None)
                        {
                        }
                        else
                        {
                            OperationContext.Current.OutgoingMessageHeaders.Add(MessageHeader.CreateHeader(ConfigData.XName.LocalName, ConfigData.XName.NamespaceName, config));
                            channel.ProcessMessage(msgbuffer.CreateMessage());
                        }
                        Trace.WriteLine("VirtualService: --- Message has been sent to tester ---");

                        #region check for action

                        #endregion
                    }
                    factory.Close();
                }
            }
            catch (CommunicationException ex)
            {
                if (factory != null)
                {
                    if (factory.State == CommunicationState.Faulted)
                    {
                        factory.Abort();
                    }
                    else if (factory.State != CommunicationState.Closed)
                    {
                        factory.Close();
                    }
                    factory = null;
                }
                Trace.WriteLine(ex.InnerException == null ? ex.Message : ex.InnerException.Message);
            }
            catch (Exception ex)
            {
                if (factory != null)
                {
                    if (factory.State == CommunicationState.Faulted)
                    {
                        factory.Abort();
                    }
                    else if (factory.State != CommunicationState.Closed)
                    {
                        factory.Close();
                    }
                    factory = null;
                }
                Trace.WriteLine(ex.InnerException == null ? ex.Message : ex.InnerException.Message);
            }
        }
コード例 #26
0
 /// <summary>
 /// Enables inspection or modification of a message after a reply message is received but prior to passing it back to the client application.
 /// </summary>
 /// <param name="reply">The message to be transformed into types and handed back to the client application.</param>
 /// <param name="correlationState">Correlation state data.</param>
 public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     Procesos.responseStatus = reply.ToString();
 }
コード例 #27
0
            public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
            {
                soapMessages.SoapRequest = request.ToString();

                return(null);
            }
コード例 #28
0
 void IDispatchMessageInspector.BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     Console.WriteLine("IDispatchMessageInspector.BeforeSendReply:\n{0}", reply.ToString());
 }
コード例 #29
0
            object IDispatchMessageInspector.AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel, System.ServiceModel.InstanceContext instanceContext)
            {
                Console.WriteLine("IDispatchMessageInspector.AfterReceiveRequest:\n{0}", request.ToString());
                string un = request.Headers.GetHeader <string>("u", "username");
                string ps = request.Headers.GetHeader <string>("p", "password");

                if (un == "admin" && ps == "123")
                {
                    Console.WriteLine("It is OK");
                }
                else
                {
                    Console.WriteLine("bad username or password");
                }
                return(null);
            }
コード例 #30
0
 public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
 {
     Console.WriteLine("IClientMessageInspector AfterReceiveReply:\n{0}", reply.ToString());
     //throw new NotImplementedException();
 }