gpt4 book ai didi

java.lang.IllegalArgumentException : Illegal character(s) in message header field: Authorization: Basic

转载 作者:行者123 更新时间:2023-12-01 18:34:09 27 4
gpt4 key购买 nike

我正在编写一个 java 类来触发 Web 服务,但在尝试执行它时收到错误。

java.lang.IllegalArgumentException: Illegal character(s) in message header field: Authorization: Basic

当我从“Authorization: Basic”中删除冒号字符时,我没有收到错误。

MimeHeaders headers = soapMessage.getMimeHeaders();
headers.addHeader("SOAPAction", serverURI + "send");
headers.addHeader("Authorization: Basic ", "123456789123456789");

有没有办法发送冒号而不出现任何错误?

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)

最佳答案

通过替换解决:

headers.addHeader("Authorization: Basic ", "123456789123456789"); 

headers.addHeader("Authorization", "Basic 123456789123456789");

关于java.lang.IllegalArgumentException : Illegal character(s) in message header field: Authorization: Basic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60096433/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com