public string In()
        {
            //Use the value from a input header
            Header soapHeader = SoapHeaderHelper <Header> .GetInputHeader("MyHeader");

            if (soapHeader != null)
            {
                return(soapHeader.Value);
            }
            return(null);
        }
        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);
            }
        }
Exemplo n.º 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);
        }
    }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
        }