0

我是新来的骡子。我需要访问我们公司网络之外的网络服务并尝试连接代理。我在下面编写了一个示例 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 中实现相同的功能。proxy我在HTTP 连接器配置选项卡中使用代理身份验证在 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 中配置代理身份验证,除了在代理选项卡中提供详细信息之外,我们还需要其他什么吗?

4

0 回答 0