I want to set additional header fields for a given destination. Default call works.
example:
Destination destination = DestinationAccessor.getDestination("xyz");
Data data = new DefaultXyzService()
.withServicePath("/sap/opu/odata/sap/Z_XYZ_SRV")
.getDataByKey(id)
.execute(destination);
But how can i set a custom header field? Something like that
List<Header> headers = new ArrayList<Header>();
final Header HEADER = new Header("X-XYZ-ENDUSERNAME", id);
headers.add(HEADER);
DefaultHttpDestination destination2 = new DefaultHttpDestination(destination.asHttp(), headers);
Data data = new DefaultXyzService()
.withServicePath("/sap/opu/odata/sap/Z_XYZ_SRV")
.getDataByKey(id)
.execute(destination2);
results in an error message: "Unable to fetch the metadata : Error fetching the metadata"
Using version 3.1.0.
Thanks and best regards,
Volker