I need to access the Web Service of Navision that is using Navision User + SSL. The connector I am using is based in PHP.
I am able to connect to simple http access and using Window's User. This is the tutorial that helped me achieve this Navision Web Service PHP written by Freddy.
I'm still using it but played around on adding the certificate in the curl/request. Researched and read a lot of article but I still cannot achieve it.
I am now able to access it using the base php connector shared above (link) but when retrieving data I am receiving the details below:
... successfully set certificate verify locations:
* CAfile: /Path/Navision.pem
* SSL connection using TLSv1.0 / AES256-SHA
* Server certificate:
...
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* Server auth using NTLM with user 'user'
POST Navision Page URL Name HTTP/1.1
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
...
Method: POST
Connection: Keep-Alive
User-Agent: PHP-SOAP-CURL
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:microsoft-dynamics-schemas/page/pda_item_list:ReadMultiple"
...
< HTTP/1.1 401 Unauthorized ...
I used the certificate by using the makecert.exe. I have these files 2 .cer, a pvk and a .crl.. We used one of the .cer file took the thumbprint to apply it on the navision service instance. Which of the file is the correct one to be used by the php curl connector.
Here is my request php code:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_setopt($ch, CURLOPT_USERPWD, USERPWD);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . '/Navision.pem');
Any link that is related would be much appreciated specially if I'll be able to use the web service of Navision using PHP connector by accessing it using Navision User and SSL.
UPDATE
I am now able to use the valid certificate and able to pass through properly. Still it doesn't now work and returns the the same error above.. Unauthorized 401.
Most likely it is because of my Navision setup or I am just passing the credentials in a wrong way? I am still researching and playing so currently I am still not able to pull the data.