Reputation: 4043
I am writing a java class to trigger a webservice, but I am getting the error when trying to execute it.
java.lang.IllegalArgumentException: Illegal character(s) in message header field: Authorization: Basic
when I remove the colon character from "Authorization: Basic ", I am not getting the error.
MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", serverURI + "send");
headers.addHeader("Authorization: Basic ", "123456789123456789");
Is there a way to send the colon without any errors?
java -version
java version "1.7.0_131"
OpenJDK Runtime Environment (rhel-2.6.9.0.el6_8-x86_64 u131-b00)
OpenJDK 64-Bit Server VM (build 24.131-b00, mixed mode)
Upvotes: 0
Views: 3603
Reputation: 61
I had copied the headers from a cURL call, which had "Authorization: ". Removing the colon solved the problem.
Upvotes: 0
Reputation: 4043
Solved by replacing:
headers.addHeader("Authorization: Basic ", "123456789123456789");
with
headers.addHeader("Authorization", "Basic 123456789123456789");
Upvotes: 2