Ah, misunderstood you there. Second try:
See Erwin's advise at https://forum.mendix.com/link/questions/11982.
In your javacode you are encoding the usernameandpassword, but that is the client's concern. Your handler will be doing the decoding of the header, checking if the credentials are valid and if so, redirecting to the outofthebox Mendix webservice.