cancel
Showing results for 
Search instead for 
Did you mean: 

Consumeing SAP ODATA service from .Net

venkateswaran_k
Active Contributor
0 Kudos

Dear All

I have created a odata service and registered it in Gateway.

http://myname:8000/sap/opu/odata/sap/ZGL2_SRV/GLListSet

I am able to get the output in browser.

But when I call this service from the .net application, I am getting 401 Authentication error.

Can someone help me ?

1. Any specific thing that I should supply in the request header..?

Or

2. Any server side authentication to be provided?

my .netcode is like this.

$.ajax({

                url: q,

                type: "GET",

                dataType: "xml",

                beforeSend: function (req) {

                    req.setRequestHeader("Authorization", "Basic dmVua2F0OjEwMDNNYXJjaCQ=");

                },

Regards,

Venkat

Accepted Solutions (1)

Accepted Solutions (1)

kammaje_cis
Active Contributor
0 Kudos

Problem might be with HTTP/HTTPS or with credentials itself.

Code seems to be simple javascript.

$.ajax
({
  type
: "GET",
  url
: "XXXXX",
  dataType
: 'xml',
  headers
: {
  
"Authorization": "Basic " + btoa(USERNAME + ":" + PASSWORD)
 
},
  success
: function (){
  alert
('Success');
 
}
});

Answers (0)