---
title: "根据wsdl 文件自动生产 webservice 客户端(jax-ws) 相关超时问题"
author: "chen422520"
date: "2012-07-04T14:39:24Z"
tags: []
categories: ["编程语言"]
slug: "wsdl-webservice-jax-ws"
draft: false
lastmod: "2012-08-10T14:48:29Z"
id: 1576477
url: "https://chen422520.iteye.com/blog/1576477"
---

1  最近项目中,使用到了webservcie, 采用了eclipse自带的 工具,根据wsdl 文件来产生 webservice 客服端,

 

    生成的客服端在开始使用中没有 什么问题,由于后面用户量上来了,发现很多用户都查询不到,或者得不到服务的

 

    相应,最后调试 发现是由于调用其他的的webservice 时 阻塞了,影响后面的用户请求

 

 

   经过 网上的搜索,找到了jax-ws 设置超时的方法

 

    首先 把需要调用的类 进行如下转换

 

    BindingProvider bindingP=(BindingProvider)clientToservice;

 

 

  (1)  连接超时

 

```
BindingProviderProperties.CONNECT_TIMEOUT



```

 

   （2） 方法请求超时

 

```
BindingProviderProperties.REQUEST_TIMEOUT



```

 

   设置，通过  BindingProvider

 

 

   bindingP.getRequestContext().put(BindingProviderProperties.REQUEST\_TIMEOUT, 1* 1000)