gpt4 book ai didi

java - org.apache.axis2.AxisFault :Transport error: 407 Error:Proxy Authentication Required

转载 作者:行者123 更新时间:2023-12-02 07:11:22 34 4
gpt4 key购买 nike

这是我的代码..我正在尝试使用 .asmx?WSDL Web 服务。

错误:org.apache.axis2.AxisFault:传输错误:407 错误:需要代理身份验证

    package org.tempuri;


import org.apache.axis2.AxisFault;
import org.tempuri.ServiceStub.Get_All_Pendancy_List;
import org.tempuri.ServiceStub.Get_All_Pendancy_ListResponse;



public class TestClient {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {

//

//

//Proxy Settings

System.getProperties().put("http.proxyHost", "111.11.11.11");
System.getProperties().put("http.proxyPort", "1111");
System.getProperties().put("http.proxyUser", "11111");
System.getProperties().put("http.proxyPassword", "SaK@11111");


ServiceStub serviceStub = new ServiceStub();
Get_All_Pendancy_List gpl = new Get_All_Pendancy_List();
gpl.setDept_code("1111");
gpl.setUsr("1111");
gpl.setPasswd("1111@1111");
gpl.setDate("01/01/2012");

Get_All_Pendancy_ListResponse response = serviceStub.get_All_Pendancy_List(gpl);
System.out.println(response.getGet_All_Pendancy_ListResult());



} catch(AxisFault e1 ) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}



}

}

有什么建议吗?我应该如何设置我的代理配置?

最佳答案

好的..就是这样,这就是您如何通过 axis2 的代码设置代理设置

// Proxy Settings    
HttpTransportProperties.ProxyProperties HTTPProxyProperties = new HttpTransportProperties.ProxyProperties();
HTTPProxyProperties.setProxyName("PROXYHOST");
HTTPProxyProperties.setProxyPort(PROXYPORT);
HTTPProxyProperties.setUserName("USERNAME");
HTTPProxyProperties.setPassWord("PASSWORD");
HTTPProxyProperties.setDomain("DOMAIN");

Options options = serviceStub._getServiceClient().getOptions();
options.setProperty(MessageContextConstants.HTTP_PROTOCOL_VERSION,
HTTPConstants.HEADER_PROTOCOL_10);
options.setProperty(HTTPConstants.PROXY, HTTPProxyProperties);

关于java - org.apache.axis2.AxisFault :Transport error: 407 Error:Proxy Authentication Required,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15476584/

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