---
title: "代理访问WebService"
author: "Dollyn"
date: "2008-07-29T13:42:42Z"
tags: []
slug: "webservice"
draft: false
lastmod: "2008-07-29T13:42:42Z"
id: 221038
url: "https://dollyn.iteye.com/blog/221038"
---

不知道大家有没有遇到公司需要访问外网的webservice，但公司内部有代理，必须通过代理访问。  
再axis中提供了很方便的方法来设置http proxy。  
我们在用axis client调用远程webservice时只要加入下面代码即可：  
     AxisProperties.setProperty(http.proxyHost,$your proxy host);  
     AxisProperties.setProperty(http.proxyPort,$proxy port);  
     AxisProperties.setProperty(http.proxyUser,$your username );（如：APACUSER1）  
AxisProperties.setProperty(http.proxyPassword,$password);  
AxisProperties是全局静态变量一次设置在整个生命周期中都会生效。