コード例 #1
0
        public string In()
        {
            //Use the value from a input header
            Header soapHeader = SoapHeaderHelper <Header> .GetInputHeader("MyHeader");

            if (soapHeader != null)
            {
                return(soapHeader.Value);
            }
            return(null);
        }
コード例 #2
0
        public void InOut()
        {
            //Use input header
            Header soapHeader = SoapHeaderHelper <Header> .GetInputHeader("MyHeader");

            if (soapHeader != null)
            {
                //and set the value back in the output header
                soapHeader.Value += " InOut";
                SoapHeaderHelper <Header> .SetOutputHeader("MyHeader", soapHeader);
            }
        }
コード例 #3
0
    public bool DoWork()
    {
        AuthHeader authentication = SoapHeaderHelper <AuthHeader> .GetInputHeader("AuthHeader");

        if (@"userName".Equals(authentication.Username) && @"pwd".Equals(authentication.Password))
        {
            //Do your thing
            return(true);
        }
        else
        {
            //if authentication fails
            return(false);
        }
    }
コード例 #4
0
        public System.Data.DataSet Read(string targetCategory, string viewName, NBK.Common.Foundations.Utilities.FilterCriteria[] filterCriteria, NBK.Common.Foundations.Utilities.SortCriteria[] sortCriteria, int startIndex, int numberOfRecords, ref int totalNumberOfRecords)
        {
            try
            {
                Header = SoapHeaderHelper <WebServiceHeader> .GetInputHeader("Header");

                const string location = "NBK.EAI.Services.Web.NBKCentral.Read";
                using (LogEnterExit lee = new LogEnterExit(location))
                {
                    string _instanceName = "";
                    if (string.IsNullOrEmpty(viewName))
                    {
                        _instanceName = "READ_" + targetCategory + "_VW_" + "Default";
                    }
                    else
                    {
                        _instanceName = "READ_" + targetCategory + "_VW_" + viewName;
                    }

                    //Do data validation before delegating to Request Router
                    CheckArgument(targetCategory != null && targetCategory != "", "Target Category cannot be null or empty");

                    //Delegate the call to the Request Router class
                    DataSet result = RequestRouter.Read(GetCallContext(), targetCategory, viewName,
                                                        filterCriteria, sortCriteria, startIndex, numberOfRecords,
                                                        ref totalNumberOfRecords);

                    return(result);
                }
            }
            catch (Exception ex)
            {
                BaseException.Publish(ex);

                //LogCallContext();

                throw ExceptionUtils.GetSOAPException(ex);
            }
        }
コード例 #5
0
        /// <summary>
        /// Ověření tokenu
        /// </summary>
        /// <returns></returns>
        private bool VerifyToken()
        {
            this._appId = String.Empty;

            // Získání tokenu z hlavičky
            AuthToken authToken = SoapHeaderHelper <AuthToken> .GetInputHeader("AuthToken");

            string token = (authToken == null ? String.Empty : authToken.Value);

            if (String.IsNullOrWhiteSpace(token))
            {
                SoapHeaderHelper <ActionResult> .SetOutputHeader("ActionResult", new ActionResult()
                {
                    StatusId = ActionStatus.InvalidToken.ToShort(), StatusDesc = "Invalid token"
                });

                return(false);;
            }

            // Ověření platnosti tokenu
            Token       tkn  = new Token(Bc.SecretKey, "AuthToken", token);
            TokenStatus stat = tkn.Verify();

            this._appId = tkn.Id;

            if (stat != TokenStatus.Valid)
            {
                SoapHeaderHelper <ActionResult> .SetOutputHeader("ActionResult", new ActionResult()
                {
                    StatusId = ActionStatus.InvalidToken.ToShort(), StatusDesc = "Invalid token"
                });

                return(false);;
            }

            return(true);
        }