I am using this code which utilizes an odata4j ODataClientRequest
and ODataConsumer
to attempt to call an OData service that requires authentication:
String url = "https://mylocalhost/api/odata/People()?$filter=PID%20eq%20'10'";
Map<String, String> headers = new HashMap<String, String>();
headers.put("AccountID", "100");
ODataClientRequest clientRequest = new ODataClientRequest("GET", url, headers, null, null);
ODataConsumer consumer = ODataConsumer.create(url);
for(OEntity entity : consumer.getEntities("People").execute()){
However, I'm getting an authentication error, because the server is requesting header authentication information. How can I create my ODataConsumer
that includes the required authorization header information?