Site Tools


guides:ws_store_checksum

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
guides:ws_store_checksum [2018/10/26 18:24] brett.zamoraguides:ws_store_checksum [2019/06/04 23:51] (current) brett.zamora
Line 9: Line 9:
  
  
-<code>+<code xml>
 <PRIA_DOCUMENT _Code="Deed" DocumentSequenceIdentifier="1" RequestChecksumAlgorithm="SHA384" RequestChecksumValue="19AEA2BD-D793-44F0-BBA4-C7F33F0ED27A" ResponseChecksumAlgorithm="SHA384" ResponseChecksumValue="66182401-414F-4901-A212-B8AC18C3E1DE"> <PRIA_DOCUMENT _Code="Deed" DocumentSequenceIdentifier="1" RequestChecksumAlgorithm="SHA384" RequestChecksumValue="19AEA2BD-D793-44F0-BBA4-C7F33F0ED27A" ResponseChecksumAlgorithm="SHA384" ResponseChecksumValue="66182401-414F-4901-A212-B8AC18C3E1DE">
 </code> </code>
Line 19: Line 19:
 <color #7092be>Request Endpoint</color> <color #7092be>Request Endpoint</color>
  
-{{tablelayout?colwidth="100px,500px"&rowsFixed=1&rowsVisible=10&float=center}}+{{tablelayout?colwidth="75px,575px"&rowsFixed=1&rowsVisible=10&float=center}}
 ^ Method ^ URL ^ ^ Method ^ URL ^
-| POST | <nowiki>https://apex-prd.certna.org/storechecksum</nowiki> |+| POST | <nowiki>https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/storechecksum</nowiki> |
  
  
Line 34: Line 34:
 ^ Key ^ Value ^ ^ Key ^ Value ^
 | Content-Type | application/json | | Content-Type | application/json |
 +| access_token | {soft-token} |
  
  
Line 58: Line 59:
 **Endpoint:** **Endpoint:**
  
-<nowiki>https://apex-prd.certna.org/storechecksum</nowiki>+<nowiki>https://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/storechecksum</nowiki>
  
  
Line 75: Line 76:
  
  
-**Sample Response:**+<color #7092be>Sample Response</color>
  
 Status Code: 200 Status Code: 200
Line 108: Line 109:
  
 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. 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>[:guides:sample_sha384_hash&noheader&noindent&nofooter&nouser&nodate&noeditbtn&nopermalink]}}
 +
 +
 +**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?colwidth="150px,450px"&rowsFixed=1&rowsVisible=10&float=center}}
 +^ Parameter ^ Source ^
 +| checksum | The Base64 encoded value of the SHA384 binary checksum that was calculated for the DOCUMENT string.  |
 +
 +
 +<code C#>
 +Public static void StoreChecksumExample()
 +{
 +// In this example I am picking up the checksum value I calculated from a 
 +// form field in the sample application that is available on this Wiki.
 +
 +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://apex-prd.certna.org/APEX/Service/APEXPublicServer.svc/storechecksum";
 +
 +client = new RestClient(strURL);
 +request = new RestRequest(Method.POST);
 +
 +strParms = "{\n\t\"checksum\" : \"";
 +strParms += strChecksumValue;
 +strParms += "\"\n}";
 +
 +request.AddHeader("Cache-Control", "no-cache");
 +request.AddHeader("Content-Type", "application/json");
 +request.AddHeader("access_token", token);
 +request.AddParameter("StoreChecksum", strParms, ParameterType.RequestBody);
 +
 +response = client.Execute(request);
 +
 +if (response.IsSuccessful)
 +{
 +var jsonResult2 = JsonConvert.DeserializeObject<dynamic>(response.Content);
 +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<dynamic>(response.Content);
 +string str_ErrorCode = jsonResult2.ToString();
 +
 +// Do something with the error result
 +}
 +}
 +</code>
 +
 +
 +**Comment 3:**
 +
 +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;
 +}
 +</code>
 +
 +
 +**Comment 4:**
 +
 +CeRTNA has posted a simple [[:guides:sample_web_service_project|Visual Studio 2015 WPF/C# project]] on the CeRTNA Wiki that demonstrates how to look up values in an XML file and how to use the Login, StoreChecksum, and ValidateChecksum web services. The project can be downloaded from the Wiki. As stated earlier, the purpose of the code samples is not to demonstrate well structured code, but rather to provide a very simple, functional sample, that you can use for reference in adding CeRTNA web service calls to your existing application. The code sample is provided as is, however, your production code would be expected to contain more extensive error handling, etc.
 +
 +
 +**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/apps
  
guides/ws_store_checksum.1540578258.txt.gz · Last modified: by brett.zamora