首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Transport:传输错误: 407错误:需要代理身份验证

Transport:传输错误: 407错误:需要代理身份验证
EN

Stack Overflow用户
提问于 2013-03-18 20:13:01
回答 1查看 4.1K关注 0票数 0

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

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

代码语言:javascript
复制
    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();
            }



        }

    }

有什么建议吗?如何设置代理配置?

EN

回答 1

Stack Overflow用户

发布于 2013-03-20 14:50:18

好的..。这就是如何通过代码为axis2设置代理服务器

代码语言:javascript
复制
// 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);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15476584

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档