我想在JBoss中为服务添加超时。
问题是当我为WSDL运行此行时:
@Override
public void onClick(View v) {
if(mp1!=null){
try{
mediaPlayer.stop();
mediaPlayer=null;
mediaPlayer.release();
}
}
catch(IllegalStateException e){
//System.out.println(e);
}
catch(Exception e){
//System.out.println(e);
}
else{
mp1.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
// TODO Auto-generated method stub
mp.start();
}
});
mp1.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub
mp.release();
}
});
}
我从WSDL那里得到超时:
org.jboss.ws.core.WSTimeoutException:超时后:30000ms
我尝试为我的服务添加超时,如:
Service service = Service.create(wsdlURL, serviceName);
但我有例外。 这是什么原因?
答案 0 :(得分:0)
尝试使用javax.xml.ws.client.connectionTimeout
和javax.xml.ws.client.receiveTimeout
。
例如:
//Set timeout until a connection is established
((BindingProvider)port).getRequestContext().put("javax.xml.ws.client.connectionTimeout", "6000");
//Set timeout until the response is received
((BindingProvider) port).getRequestContext().put("javax.xml.ws.client.receiveTimeout", "1000");