请帮助如何从 SAP 网关服务获取数据。SAP 团队给出了这个 url::- http://Gateway_host:Gateway_port/sap/opu/odata/sap/ API SRV/ApplicationPendingListSet?$filter=UserID eq 'XXXXX' 和用户 ID 和密码。如何在 asp.net 中获取这些数据。
请帮忙。
请帮助如何从 SAP 网关服务获取数据。SAP 团队给出了这个 url::- http://Gateway_host:Gateway_port/sap/opu/odata/sap/ API SRV/ApplicationPendingListSet?$filter=UserID eq 'XXXXX' 和用户 ID 和密码。如何在 asp.net 中获取这些数据。
请帮忙。
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);
}