cancel
Showing results for 
Search instead for 
Did you mean: 

How to invoke rest web services for POST(Create) Opeation from C#.net

Surekha
Participant
0 Kudos

Hi,

I have created SAP netwaver Gateway Web service .

As i tested the web service for Get,POST operation in SAP netwaever as well as on Chrome Rest client also and it's works fine..

We are facing some issue while consuming that web service in .net application for POST Opeartion.

We are getting data in .Net application but we are not geeting how to pass values to service and Post data using service.

Your help will be appreciable.

We are facing exception like DataServiceRequestException after invoking service .

Code is as below

  

            string serviceUrl = "http://server name:port/sap/opu/odata/sap/ZGET_USER_DATA_123_SRV/users";

               service.Credentials = new NetworkCredential("test", "12345");

             UserList USER= new UserList()

            {

                Username = "ABC123",

                Lastname = "TEST",

                Firstname = "ABC",

                Fullname = "MULTI",

            };

            service.AddTousers(USER);

           service.SaveChanges();//ERROR COMING TO THIS POINT

           WHEN WE TRIGGER SAVECHANGES METHOD IT'S RAUSES DataServiceRequestException ......

            It's urgent.....

Accepted Solutions (0)

Answers (1)

Answers (1)

Surekha
Participant
0 Kudos

Hi ,

I am able to sort out the issue.It was with CSRF Token validation.

That problem was with CSRF TOKEN setting in SICF.

You need to double click on service and then go to Change mode.

Click GUI Configuration and set values.

  • Parameter Name: ~CHECK_CSRF_TOKEN
  • Parameter Value: 0/1 (disable/enable)

I set value to 0.So i could consume service .


Thanks

Surekha