Skip to Content
0
Aug 11, 2016 at 10:49 AM

403-Forbidden Errors when Olingo post data to Gateway OData Service via Cloud Connector

615 Views

Hi Expert,

I encountered the tricky problem as the title.

Here is the environment:

--Has Registered the OData service in ABAP Gateway Server;

--Has Exposed the OData Service URL in Cloud Connector;

--Has Created the Destination in HCP, connection is OK;

--Develop java application, use Olingo API to post data to the OData service (creation operation), then deploy the java application to HCP

However, the result is 403-Forbidden.

Java codes as below:

//get CSRF-Token via service URL --OK

Object csrfToken = odataService.getCSRFToken(destConfiguration, "/", IODataService.APPLICATION_JSON);

//POST URL -- OK

path = "/LeaveRequestCollection";

conn = odataService.getConnection(destConfiguration, path, IODataService.HTTP_METHOD_POST, IODataService.APPLICATION_JSON);

if (csrfToken != null) {

conn.setRequestProperty("x-csrf-token", csrfToken.toString());

}

//POST -- but failed

ODataEntry entry = odataService.createEntry(conn, edm, "LeaveRequestCollection", postData);

do you have any suggestions? Do I need extra parameters or need config in ABAP gateway server?

Thanks so much.