I am using the DHIS2 connector to synchronize aggregated data from openmrs (indicators) to dhis2 (dataelements). The module works within linux environment (redhat) , but when I used it on windows platform (using openmrs-sdk) and when I click on “Create Mapping” the list of dataset was empty. I looked at dhis2 logs and I found this message: 127.0.0.1 - - [14/Dec/2018:09:09:02 +0100] “GET null null” 400 -
It said that the request sent by openmrs was bad. I looked at the request sent by openmrs and it looks like the parameters within json request are not encoded:
I tried to add some parameters when I run the server to encode the request sent by tomcat :
mvn openmrs-sdk:run -DserverId=distro1 -Ddebug -Djavax.servlet.request.encoding=UTF-8 -Dfile.encoding=UTF-8
But I still have the problem.
Have you any idea ?
Many thanks in advance.
Which DHIS2 connector module are you using, Jembi’s openmrs-module-dhisconnector?
If that’s the case it “could” be because of this:
Header bs = new BasicScheme().authenticate(creds, httpGet, localcontext);
The character encoding is not specified anywhere (for example compare this to this other DHIS2 module that queries the same API here).
It might be that on Linux this nicely defaults to UTF-8, while on Windows this doesn’t default to anything that will be understood by DHIS2. Not the exact same Java version nor implementation… etc etc.
dhisconnector is definately the first one not dhisreport @mksd and i agree that could be the cause of the issue.
are you able to wire a Pull request @amine?
Hi @mksd, thank you very much for your reply yes I was talking about jembi module.
That’s exactly what I did, I modified into the method getDataFromDHISEndpoint by encoding the endpoint and it works now however, I think it will better that I modify in the header as you mentionned.
@k.joseph thanks a lot for your reply, of course, I will push a pull request with that.
Dear @k.joseph , I sent a pr which fix the issue and still waiting for your validation.
I also added new feature to the connector which allows to run automated reports for multiple location/OrgUnit mapping at once. But I can not make a new pull request with that as long as the first one is not validated.
Thanks for your feedback.
thanks @amine, am sorry i had missed that PR, i think separating the encoding fix from that new feature would make it easier to review the change. please point me to the 2 PRs as soon as you have them so i can review
thanks @k.joseph for your quick reply. I separated them into tow pr. waiting for your feedback. many thanks
@k.joseph you really ought to configure a code formatter otherwise each PR review might just become frustrating. See point 4. here for an example.
Also even more importantly, you should configure Travis CI or equivalent on that repo.