最近用微信开发,引用一个自己写的webservice出现如下问题,求高手来解决

钱志鹏 2014-07-31 10:48:38
webservice是用的axis2写的。
在本地测试调用没有问题。
放到微信那边就会报
Caused by: java.net.ConnectException: Connection timed out
at com.qzp.servlet.CoreServlet.doPost(CoreServlet.java:64)
at com.qzp.service.CoreService.processRequest(CoreService.java:229)
at com.qzp.service.MyWebService.searchWXYJ(MyWebService.java:30)

可是上述MyWebService.searchWXYJ(),自己在本地调用测试缺没有任何问题。到底是什么原因呢,求高手解决

附上我的webservice的调用方法

public class MyWebService {

@SuppressWarnings({ "rawtypes" })
public static String searchWXYJ(String salary){
//最好的返回值
String y=null;
try{
// 使用RPC方式调用WebService
RPCServiceClient serviceClient = new RPCServiceClient();
serviceClient.getOptions().setTimeOutInMilliSeconds(1000 * 60 * 3);
Options options = serviceClient.getOptions();
// 指定调用WebService的URL
EndpointReference targetEPR = new EndpointReference("http://61.132.89.94:4848/axis2/services/MyService");
options.setTo(targetEPR);
// 指定getGreeting方法的入参值
String[] yoursalary= new String[] {salary};
// 指定getGreeting方法返回值的数据类型的Class对象
Class[] insurance = new Class[] {Float.class};
// 指定要调用的getGreeting方法及WSDL文件的命名空间
QName opAddEntry = new QName("http://ws.apache.org/axis2", "getInsurance");
//三个参数对应调用方法名、入参和返回值
Float wxyj= (Float) serviceClient.invokeBlocking(opAddEntry, yoursalary, insurance)[0];
y=wxyj+"";
return y;
}catch(Exception e){
e.printStackTrace();
y="连接超时";
return y;
}
}
public static void main(String[] args) throws Exception {
System.out.println(MyWebService.searchWXYJ("10000"));

}

}
...全文
822 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
KK3K2005 2014-12-25
  • 打赏
  • 举报
回复
是不是有防火墙之类问题
jayenhoo 2014-12-24
  • 打赏
  • 举报
回复
楼主,我也遇到同一个问题,你解决得怎么样了
海兰 2014-08-02
  • 打赏
  • 举报
回复
telnet一下你所连的网络,看是不是通的

24,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧