2011-11-03 21 views
1

考慮下面的代碼片段在applet中運行的insdie瀏覽器:Web服務客戶端(applet)中一直要求 「/META-INF/services/javax.xml.ws.spi.provider」

WebServiceClient s = MyWS_Service.class.getAnnotation(WebServiceClient.class); 
String servicePath = pathName; 
String wsdlLocation = "http//host.dns.name:80/MYWSAPP/MyWS?wsdl"; 
MyWS_Service service = null; 
WebServiceClient s = MyWSService.class.getAnnotation(WebServiceClient.class); 
try{ 
    wsdlURL = new URL(wsdlLocation); 
    service = new myWSService(wsdlURL, new QName(s.targetNamespace(), s.name())); 
    myWS = service.getMyWSSOAP(); 

}catch (MalformedURLException e){ 
    System.out.println ("unable to create wsdlURL = "+wsdlLocation); 
} 

如果myWS創建時沒有問題,我使用它來調用Web服務方法(Web服務使用Metro並在Tomcat上運行)。

一切正常,只是我注意到以下兩個刺激: :

  1. 這需要很長的時間來執行的代碼上面
  2. 網絡跟蹤援引塊顯示客戶端發送HTTP GET的請求/MYWSAPP/META-INF/services/javax.xml.ws.spi.provider和/MYWSAPP/META-INF/services/javax.xml.stream.XMLInputFactory。

這些GET請求的答覆是HTTP/1.1 404 Not Found。

有關如何防止這些不必要的HTTP GET請求的想法?上面的代碼需要大約3秒鐘的時間才能執行,而實際的Web服務調用需要不到100ms的執行時間呢?

回答

0

傳遞此參數的小程序:

codebase_lookup = false