I'm having a very strange issue.
My company uses a centralized user registration web-service for our various properties. We generally send a request to the web service via HttpURLConnection with request-method GET, setting parameters via qs. This has worked fine in the past.
For another property with which we've recently acquired and plugged into our registration web service, HttpURLConnection seems to be duplicating parameters when sent along. The expected value of a parameter is paramName=value
, but we're receiving paramName=value, value
instead. Here's a representation of what it looks like in our logs:
Note: Removing information specific to my employer and our systems.
01-26 15:21:54 [TP-Processor17] INFO com].[/] - parameter=userName=nameValue65, nameValue65
01-26 15:21:54 [TP-Processor17] INFO com].[/] - parameter=policyAccepted=true, true
This, of course, caused the end-point validation to error and disable user-registration.
Here's a representation of the code used to create the connection:
URL url = new URL("http://account-ws.domain.tld/register.action?responseType=json&userName=nameValue65&age=24&country=US&password1=Passw3rt&emailAddress=name@domain.tld&tosAccepted=true&policyAccepted=true");
HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
urlc.setRequestMethod("GET");
urlc.setDoOutput(true);
urlc.setAllowUserInteraction(false);
PrintStream ps = new PrintStream(urlc.getOutputStream());
ps.print(restEndPoint);
ps.close();
Perhaps(?) useful info:
- The registration form submits to itself using POST, at which point we validate using Struts forms, and send the request to the web service using the values returned by the Struts form validation class. (These values are checked for accuracy once more before sending.)
- Wireshark and log4j debug messages indicate that the URL sent to the web service is correct / what we would expect, with single values for each parameter.
- The initiating form's post fields are named identically to the query keys sent with the web service request.
Please ask for more info if you find what's here to be insufficient.
Thank you in advance! :)