// Get all IDProofs option from web services 
        public async void postXMLData1()
        {
           
                string uri = AppStatic.WebServiceBaseURL;  // some xml string
                Uri _url = new Uri(uri, UriKind.RelativeOrAbsolute);
                getIDProofsRequest _objeIDProof = new getIDProofsRequest();
                _objeIDProof.franchUserID = AppStatic.franchUserID;
                _objeIDProof.password = AppStatic.password;
                _objeIDProof.userID = AppStatic.userID;
                _objeIDProof.userKey = AppStatic.userKey;
                _objeIDProof.userName = AppStatic.userName;
                _objeIDProof.userRole = AppStatic.userRole;
                _objeIDProof.userStatus = AppStatic.userStatus;
                _objeIDProof.userType = AppStatic.userType;
                _objeIDProof.studID = pickDropHelper.objGetAvailableService.studID;

                xmlUtility listings = new xmlUtility();
                XDocument element = listings.getIDProof(_objeIDProof);
                string file = element.ToString();
                var httpClient = new Windows.Web.Http.HttpClient();
                var info = AppStatic.WebServiceAuthentication;
                var token = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(info));
                httpClient.DefaultRequestHeaders.Authorization = new Windows.Web.Http.Headers.HttpCredentialsHeaderValue("Basic", token);
                httpClient.DefaultRequestHeaders.Add("SOAPAction", "");
                Windows.Web.Http.HttpRequestMessage httpRequestMessage = new Windows.Web.Http.HttpRequestMessage(Windows.Web.Http.HttpMethod.Post, _url);
                httpRequestMessage.Headers.UserAgent.TryParseAdd("Mozilla/4.0");
                IHttpContent content = new HttpStringContent(file, Windows.Storage.Streams.UnicodeEncoding.Utf8);
                httpRequestMessage.Content = content;
                Windows.Web.Http.HttpResponseMessage httpResponseMessage = await httpClient.SendRequestAsync(httpRequestMessage);
                string strXmlReturned = await httpResponseMessage.Content.ReadAsStringAsync();
                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(strXmlReturned);
                XDocument loadedData = XDocument.Parse(strXmlReturned);
                var sdata = loadedData.Descendants("idProofs").
               Select(x => new getIDProofs
               {
                   idProofID = x.Element("idProofID").Value,
                   idProofName = x.Element("idProofName").Value,
               }).ToList();
                foreach (var item in sdata)
                {
                    getIDProofs pl = new getIDProofs();
                    pl.idProofID = item.idProofID;
                    pl.idProofName = item.idProofName;
                    _getIDProofs.Add(pl);
                }
                ListMenuItemsIDPRoof.ItemsSource = sdata;
                getIDProofs pls = new getIDProofs();
           
        }
Ejemplo n.º 2
0
        public XDocument getIDProof(getIDProofsRequest _objgetIDProofsRequest)
        {
            XDocument doc = null;
            XElement root = null;
            string servicename = "GetIDProofs";

            XmlDocument servicesNames = new XmlDocument();
            try
            {
                XNamespace fc = AppStatic.BusIndiaWebService;
                XNamespace soapenv = AppStatic.XmlSoapSchema;
                doc = new XDocument(new XDeclaration("1.0", "utf-16", "yes"),
                root = new XElement(soapenv + "Envelope",
                    new XAttribute(XNamespace.Xmlns + "com", fc.NamespaceName),
                    new XAttribute(XNamespace.Xmlns + "soapenv", soapenv.NamespaceName),
                    new XElement(soapenv + "Header"),
                    new XElement(soapenv + "Body",
                    new XElement(fc + servicename,
                    new XElement("arg0",
                    new XElement("stuIDs", _objgetIDProofsRequest.studID),
                    new XElement("wsUser",
                    new XElement("franchUserID", _objgetIDProofsRequest.franchUserID),
                    new XElement("password", _objgetIDProofsRequest.password),
                    new XElement("userID", _objgetIDProofsRequest.userID),
                    new XElement("userKey", _objgetIDProofsRequest.userKey),
                    new XElement("userName", _objgetIDProofsRequest.userName),
                    new XElement("userRole", _objgetIDProofsRequest.userRole),
                    new XElement("userStatus", _objgetIDProofsRequest.userStatus),
                    new XElement("userType", _objgetIDProofsRequest.userType)
                    )
                    )
                    )
                    )
                    )

                );
            }
            catch (Exception ex)
            {
            }
            return doc;
        }