Bonjour,
Je souhaite me connecter aux service OData de Microsoft CRM 2016. Pour cela je compte utiliser Olinga. Notre serveur est configuré pour accepter l'authentification NTLM. J'accède bien aux service SOAP de MS CRM avec axis2/ntm par exemple.
Avec Olinga j'ai constamment une erreur 401/Unauthorized...
Voici le code:
Et le résultat:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 public final static void main(String[] args) { try { ODataClient client = ODataClientFactory.getClient(); ODataServiceDocumentRequest req = client.getRetrieveRequestFactory().getServiceDocumentRequest(Resources.SERVICEROOT); String host = Resources.HOST; //String host = InetAddress.getLocalHost().getHostName(); NTLMAuthHttpClientFactory ntlm = new NTLMAuthHttpClientFactory(Resources.USERNAME, Resources.PASSWORD, host, Resources.DOMAIN); client.getConfiguration().setHttpClientFactory(ntlm); ODataRetrieveResponse<ClientServiceDocument> res = req.execute(); } catch (Exception e) { e.printStackTrace(); } }
Lorsque j'analyse le trafique réseau avec Wireshark, il n'y a qu'une trame HTTP avec la réponse 401 qui est la trame de type 1 NTLM de négociation. Les autres échanges pour l'authentification ne se font pas...org.apache.olingo.client.api.communication.ODataClientErrorException: (401) Unauthorized [HTTP/1.1 401 Unauthorized]
at org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker.checkResponse(ODataErrorResponseChecker.java:75)
at org.apache.olingo.client.core.communication.request.AbstractRequest.checkResponse(AbstractRequest.java:54)
at org.apache.olingo.client.core.communication.request.AbstractODataRequest.doExecute(AbstractODataRequest.java:310)
at org.apache.olingo.client.core.communication.request.retrieve.ODataServiceDocumentRequestImpl.execute(ODataServiceDocumentRequestImpl.java:57)
at org.apache.olingo.client.core.communication.request.retrieve.ODataServiceDocumentRequestImpl.execute(ODataServiceDocumentRequestImpl.java:37)
at org.talend.training.mscrm20216.OData.MSCrm2016OData.main(MSCrm2016OData.java:47)
Merci pour tout aide,
Cordialement.
Partager