An example on how to do a secure ping to make sure you are speaking to the correct web service and that your connection has not been hijacked. This example includes a dotnet soap request to communicate with a NAV web service.
The web service has two functions. A ping function and an encrypted ping function. If the encrypted ping function is used then the service running the web service and the service executing the ping function must have the same encryption key.
The payment service module in NAV 2013 R2 has an encryption functionality. I am using this functionality every time that I store user names and passwords in the database. This encryption functionality is based on the key located in the Online Service add-in folder.
You can copy the Providerkey.key file from one server to another or use the Payment Service Connection Setup page.
If the key is missing then a new key can be created in the above page.
A good rule is to begin every communication with an encrypted ping to make sure that the communication is between the intended source and destination.
To test this package add the PingWebService to the Web Services and publish.
When this has been completed an execution of the Ping Codeunit should return
Note: If the server is running as a “Network Service” you might get an authentication error. Either add the “Network Service” to your users or add a user name and a password to the bottom of the Ping Codeunit.