guides:ws_store_checksum
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guides:ws_store_checksum [2018/10/26 18:13] – brett.zamora | guides:ws_store_checksum [2019/06/04 23:51] (current) – brett.zamora | ||
---|---|---|---|
Line 2: | Line 2: | ||
- | The StoreChecksum web service is used to store the checksum value of a Base64 string contained in a CeRTNA Standard XML PRIA_DOCUMENT node. The checksum value that is passed to the StoreChecksum web service is a SHA384 binary checksum that has been converted to a Base64 string. | + | The StoreChecksum web service is used to store the checksum value of a Base64 string contained in a CeRTNA Standard XML PRIA_DOCUMENT node. The checksum value that is passed to the StoreChecksum web service is the SHA384 |
The StoreChecksum web service, returns a checksum key. The checksum key is the value that should be stored in either the RequestChecksumValue (agents) or ResponseChecksumValue(counties) property of the PRIA_DOCUMENT node, depending on who made the StoreChecksum request. | The StoreChecksum web service, returns a checksum key. The checksum key is the value that should be stored in either the RequestChecksumValue (agents) or ResponseChecksumValue(counties) property of the PRIA_DOCUMENT node, depending on who made the StoreChecksum request. | ||
Line 9: | Line 9: | ||
- | < | + | < |
< | < | ||
</ | </ | ||
Line 19: | Line 19: | ||
<color # | <color # | ||
- | {{tablelayout? | + | {{tablelayout? |
^ Method ^ URL ^ | ^ Method ^ URL ^ | ||
- | | POST | < | + | | POST | < |
Line 34: | Line 34: | ||
^ Key ^ Value ^ | ^ Key ^ Value ^ | ||
| Content-Type | application/ | | Content-Type | application/ | ||
+ | | access_token | {soft-token} | | ||
Line 58: | Line 59: | ||
**Endpoint: | **Endpoint: | ||
- | < | + | < |
Line 75: | Line 76: | ||
- | **Sample Response:** | + | <color #7092be>Sample Response</ |
Status Code: 200 | Status Code: 200 | ||
- | or | ||
- | |||
- | Status Code: 500 (When an error occurs.) | ||
<code json> | <code json> | ||
Line 89: | Line 87: | ||
</ | </ | ||
- | or | + | |
+ | **OR** | ||
+ | |||
+ | Status Code: 500 (When an error occurs.) | ||
+ | |||
+ | |||
+ | (example 1) | ||
<code json> | <code json> | ||
Line 95: | Line 100: | ||
" | " | ||
" | " | ||
- | " | + | " |
} | } | ||
} | } | ||
</ | </ | ||
- | or (example 2) | ||
- | < | + | <color # |
+ | |||
+ | Comments and sample code are provided for reference purposes only and are not intended to show all exception handling conditions and/or completed code blocks. | ||
+ | |||
+ | |||
+ | **Comment 1:** | ||
+ | |||
+ | The StoreChecksum web service requires a Base64 encoded SHA384 checksum to be provided as one of the parameters. | ||
+ | Following is a C# / .NET sample code snippet that shows how to generate a SHA3 checksum and convert the hash to a Base64 string: | ||
+ | |||
+ | |||
+ | {{page> | ||
+ | |||
+ | |||
+ | **Comment 2:** | ||
+ | |||
+ | Following is a C# / .NET sample code snippet that shows how to call the StoreChecksum web service. Your code will supply the values for the various parameters based on the following: | ||
+ | |||
+ | |||
+ | {{tablelayout? | ||
+ | ^ Parameter ^ Source ^ | ||
+ | | checksum | The Base64 encoded value of the SHA384 binary checksum that was calculated for the DOCUMENT string. | ||
+ | |||
+ | |||
+ | < | ||
+ | Public static void StoreChecksumExample() | ||
{ | { | ||
- | | + | // In this example I am picking up the checksum value I calculated from a |
- | "Code": "DatabaseError", | + | // form field in the sample application that is available on this Wiki. |
- | "Message": "Procedure or function ' | + | |
- | } | + | string strChecksumValue = tbChecksumValue.Text; |
+ | |||
+ | // The following value was obtained from your call to the Login web service. | ||
+ | |||
+ | string token = "ab34xyz3..."; | ||
+ | |||
+ | strURL = null; | ||
+ | client = null; | ||
+ | request = null; | ||
+ | response = null; | ||
+ | |||
+ | strURL = "https:// | ||
+ | |||
+ | client = new RestClient(strURL); | ||
+ | request = new RestRequest(Method.POST); | ||
+ | |||
+ | strParms = "{\n\t\" | ||
+ | strParms += strChecksumValue; | ||
+ | strParms += " | ||
+ | |||
+ | request.AddHeader(" | ||
+ | request.AddHeader("Content-Type", " | ||
+ | request.AddHeader(" | ||
+ | request.AddParameter("StoreChecksum", | ||
+ | |||
+ | response = client.Execute(request); | ||
+ | |||
+ | if (response.IsSuccessful) | ||
+ | { | ||
+ | var jsonResult2 = JsonConvert.DeserializeObject< | ||
+ | string strChecksumKey = jsonResult2.checksum_key; | ||
+ | |||
+ | // (Agents) Update the RequestChecksumValue property of the PRIA_DOCUMENT node with the value of strChecksumKey | ||
+ | // or | ||
+ | // (Counties) Update the ResponseChecksumValue property of the PRIA_DOCUMENT node with the value of strChecksumKey | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | var jsonResult2 = JsonConvert.DeserializeObject< | ||
+ | string str_ErrorCode = jsonResult2.ToString(); | ||
+ | |||
+ | // Do something with the error result | ||
+ | } | ||
} | } | ||
</ | </ | ||
- | <color # | + | **Comment 3:** |
- | Comments | + | Please note that before calling the CeRTNA web services you must establish the SecurityProtocol in your ServicePointManager. An example is shown below. The currently recommended protocol is Tls12. |
+ | |||
+ | <code C#> | ||
+ | public MainWindow() | ||
+ | { | ||
+ | InitializeComponent(); | ||
+ | System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | | ||
+ | SecurityProtocolType.Tls11 | | ||
+ | SecurityProtocolType.Tls12 | | ||
+ | SecurityProtocolType.Ssl3; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | **Comment 4:** | ||
+ | |||
+ | CeRTNA has posted a simple [[: | ||
+ | |||
+ | |||
+ | **Comment 5:** | ||
+ | |||
+ | A nice utility for experimenting with web service calls is POSTMAN. You can download a free version of POSTMAN from the following URL: https://www.getpostman.com/ | ||
guides/ws_store_checksum.1540577584.txt.gz · Last modified: by brett.zamora