在類FileUpload
即根類的web服務(由NETBEANS產生)有類和超類的功能的一些構造函數,它們中的一個我使用來創建SOAP
對象。這是尋找像
@WebEndpoint(name = "FileUploadSoap")
public FileUploadSoap getFileUploadSoap() {
return super.getPort(new QName("http://svc.qleapahead.com/",
"FileUploadSoap"), FileUploadSoap.class);
}
這個功能我爲了設置超時參數做了一些修改,這成爲像
@WebEndpoint(name = "FileUploadSoap")
public FileUploadSoap getFileUploadSoap() {
FileUploadSoap fileUploadSoap = super.getPort(new QName(
"http://svc.qleapahead.com/", "FileUploadSoap"),
FileUploadSoap.class);
((BindingProvider) fileUploadSoap).getRequestContext().put(
"com.sun.xml.internal.ws.request.timeout", 1000 * 2 * 60);
return fileUploadSoap;
}
和問題就解決了......
總之這種說法
幫助我很多
((BindingProvider) fileUploadSoap).getRequestContext().put(
"com.sun.xml.internal.ws.request.timeout", 1000 * 2 * 60);
我的WS是基於SOAP的並且使用netbeans來生成客戶端來使用web服務,你能解釋如何設置readTimeOut? – NoNaMe
'readTimeOut'是HTTP連接的屬性。我不熟悉Netbeans,但也許這個線程是有幫助的:http://stackoverflow.com/questions/9536616/setting-socket-read-timeout-with-javax-xml-soap-soapconnection –