我是骡子的新手。我需要点击我们公司网络之外的网络服务并尝试连接代理。我在下面编写了一个示例java程序,它可以正常使用代理。
URL url = new URL("WEBSERVICE_URL")
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY, PORT));
Authenticator authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication("USER", "PWD".toCharArray()));
}
};
Authenticator.setDefault(authenticator);
HttpURLConnection connection = (HttpURLConnection) url.openConnection(proxy);
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Accept", "application/json");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
上面的示例代码工作正常。我需要在mule中实现相同的功能。我在HTTP连接器配置的proxy
选项卡中使用代理身份验证在mule中尝试了它但我收到407 - Your credentials could not be authenticated: "Credentials are missing." You will not be permitted access until your credentials can be verified.
错误。
Mule -
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="WEBSERVICE_URL" port="PORT" doc:name="HTTP Request Configuration" tlsContext-ref="TLS_Context">
<http:proxy host="PROXY" port="PORT" username="USER" password="PWD"/>
</http:request-config>
我错过了任何配置吗?要在mule中配置代理身份验证,除了在代理选项卡中提供详细信息之外,我们还需要其他任何内容吗?