Pradeep Kolli Pradeep Kolli - 4 years ago 279
ASP.NET (C#) Question

How to get the data from SAP to using SAP GateWay Service

Please help how to get the data from SAP gate way services. SAP team given this url::-
http://Gateway_host:Gateway_port/sap/opu/odata/sap/ API SRV/ApplicationPendingListSet?$filter=UserID eq 'XXXXX' and user id & password. how to get this data in

Please help.

Answer Source

string SAP_ODATA_URL = @"http://ApplicationURL"; string SAP_ODATA_QUERY = "MethodName?$filter=Parameter eq '" + extensionAttribute13 + "'"; string requestUrl = SAP_ODATA_URL + SAP_ODATA_QUERY; WebRequest request = WebRequest.Create(requestUrl); request.Method = WebRequestMethods.Http.Get; request.ContentType = "application/json; charset=utf-8"; request.Credentials = new NetworkCredential("XXX", "XXX"); WebResponse response = request.GetResponse(); if (((HttpWebResponse)response).StatusCode == HttpStatusCode.OK) { Stream receiveStream = response.GetResponseStream(); StreamReader reader = new StreamReader(receiveStream); string responseFromServer = reader.ReadToEnd(); XmlTextReader xmlReader = new XmlTextReader(new StringReader(responseFromServer)); xmlReader.Read(); DataSet ds = new DataSet(); ds.ReadXml(xmlReader, XmlReadMode.Auto); }

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download