CDC WONDER API Utility
This is simple a utility written in Java to access the CDC WONDER API. If you are having trouble with another utility and you can compile and run a Java program, this may be of use. You will need to download these files:
WonderAPI.zip contains WonderAPI.java and HttpLight.java. WonderAPI is the utility to run. HttpLight is a simple wrappter around the HttpClient library, which does the http communications. The logging library is used by HttpClient. Feel free to modify the packages in the Java files to something more convenient. WonderAPI sends one request file to the WONDER API and writes the server response to a results file. It takes two parameters, a directory and a file in the directory to send. The filename starts with a dataset code and '_', like the example files. Any and all of these conventions can also be changed, the utility is simply provided as a starting point.
As of Oct. 5, 2016 the WONDER website requires access using https. The WonderAPI utility handles https communications, you just use https:// in the WONDER server url. In testing https connections we have found a couple of issues that can occur, depending on how the server certificate is set up. The WONDER website currently (Oct. 2016) doesn't have either of these issues, but here are some workarounds should they ever arise.
Trusted Certificate Issue
The HttpClient library uses Java library code to make secure connections, including a list of trusted certificates that is part of the JRE. If a server returns a certificate that's not in the JRE's trusted list, an exception is thrown. If this happens, we have another utility you can use to fix this problem:
SNI is a protocol that sits on top of TLS (the replacement protocol for SSL). By default the JDK has this option enabled. However, some server certificate configurations are not compatible with SNI, causing an exception when a secure connection to the server is attempted. When this happens you need to uncomment the line in WonderAPI that disables SNI, recompile and then try again.
If you have any questions about using these utilities, please