on 07-24-2017 10:54 AM
Am trying to POST data into SAP Net weaver 7.4 Version from SharePoint page using oData service from SAP. I am getting 200 OK message when I try from Google ARC but continue getting 403 error while trying from C# code. Below is my code snippet.
string _username = "uname";
string _password = "psw";
string setCookie = String.Empty;
CookieContainer cookieJar = new CookieContainer();
var GetURI = "http://vdderc.server.gov.ae:8000/sap/ewe/odata/sap/ZHR_IAWARD_APP_SRV/AppEntitySet(Pernr='2345',Lang='e')?sap-client=300";
var syncClient = new WebClient();
syncClient.Headers.Add("X-CSRF-Token", "Fetch");
syncClient.Credentials = new NetworkCredential("username", "psw");
var content = syncClient.DownloadString(GetURI);
string _Token = syncClient.ResponseHeaders["X-CSRF-Token"].ToString();
string cokie = syncClient.ResponseHeaders["Set-Cookie"].ToString();
/* POST Section */ string
PostURI = "http://vdderc.server.gov.ae:8000/sap/ewe/odata/sap/ZHR_IAWARD_APP_SRV/AppEntitySet?sap-client=300"; syncClient.Headers.Add("Authorization", "Basic RTAwMjQzNzE6YXByaWxAMjAxNw==");
syncClient.Headers.Add("Content-Type", "application/atom+xml"); syncClient.Headers.Add("X-CSRF-Token", _Token);
syncClient.Headers.Add("Set-Cookie", cokie);
syncClient.Credentials = new NetworkCredential(_username, _password); syncClient.UploadString(PostURI, content);
Hi Samh,
What is the port in the uri : http://vdderc.server.gov.ae:8000
Is it (8000) backend http port ?
check if this port is accessible and it is activated.
Regards,
Manjunath Hanmantgad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.