//Todo:: ERROR on request sent. Because the url attribute is dafault added and is NOT supposed to do so. Figure out a way to delete attribute.
        /// <summary>
        /// Returns all the available categories
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public override GetCategoriesResponse GetAllCategories(BaseRequest request)
        {
            var response = new GetCategoriesResponse();

            try
            {
                var xml = ConstructXMLRequest(request, RequestTypeEnum.GetCategoryCall);
                var responseStream = SendRequest(xml);
                var reader = new StreamReader(responseStream);
                string a = reader.ReadToEnd();

                //.Categories = (GetCategoryCallResponse)Deserialize(typeof(GetCategoryCallResponse), reader);
            }
            catch
            {
                throw new Exception("Error in Service.");
            }
            return response;
        }
 public virtual GetCategoriesResponse GetAllCategories(BaseRequest request)
 {
     return null;
 }
        private static XmlDocument ConstructXMLRequest(BaseRequest request, RequestTypeEnum requestType)
        {
            var xmlDoc = new XmlDocument();
            try
            {

                xmlDoc.LoadXml("<Request xmlns=\"urn:sbx:apis:SbxBaseComponents\"><RequesterCredentials><ApiUserToken>"
                            + request.ApiUserToken + "</ApiUserToken><SbxUserToken>" + request.SbxUserToken +
                            "</SbxUserToken></RequesterCredentials></Request>");
                xmlDoc.PrependChild(xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null));

                var xmlRequestNode = xmlDoc.GetElementsByTagName("Request").Item(0);

                var xmlGetRequestTypeCallNode = xmlDoc.CreateElement(requestType.ToString());
                xmlGetRequestTypeCallNode.SetAttribute("xmlns", "urn:sbx:apis:SbxBaseComponents");
                xmlRequestNode.AppendChild(xmlGetRequestTypeCallNode);

                ConstructXMLCallNode(xmlDoc, request, requestType, xmlGetRequestTypeCallNode);
            }
            catch
            {
                throw new Exception("Error in Service.");
            }

            return xmlDoc;
        }
 private static void ConstructXMLCallNode(XmlDocument xmlDoc, BaseRequest request, RequestTypeEnum requestType,
     XmlElement xmlGetRequestTypeCallNode)
 {
     switch (requestType)
     {
         case RequestTypeEnum.GetReceiptCall:
             GetReceiptCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (GetReceiptsRequest)request);
             break;
         case RequestTypeEnum.GetReceiptInfoCall:
             GetReceiptInfoCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (GetReceiptByIdRequest)request);
             break;
         case RequestTypeEnum.GetDocumentStatusCall:
             GetDocumentStatusCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (GetDocumentStatusRequest)request);
             break;
         case RequestTypeEnum.GetCategoryCall:
             break;
         case RequestTypeEnum.CreateUserCategoryCall:
             CreateUsercategoryCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (CreateUserCategoryRequest)request);
             break;
         case RequestTypeEnum.GetBillCall:
             GetBillCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (GetBillsRequest)request);
             break;
         case RequestTypeEnum.GetBillInfoCall:
             GetBillInfoCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (GetBillByIdRequest)request);
             break;
         case RequestTypeEnum.GetLoginCall:
             break;
         case RequestTypeEnum.GetBusinessCardCall:
             GetBusinessCardCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (GetBusinessCardCallRequest)request);
             break;
         case RequestTypeEnum.GetBusinessCardInfoCall:
             GetBusinessCardInfoCallXMLRequest(xmlGetRequestTypeCallNode, xmlDoc, (GetBusinessCardByIdRequest)request);
             break;
         default:
             break;
     }
 }