- Create a "weboptions" object with timeout set to 60 seconds.
- Pass this created object as second parameter to the "webread" function
Http Timeout webread not working
조회 수: 31 (최근 30일)
이전 댓글 표시
Hello, I'm running into 5 second timeout although I increased it with this webread:
import matlab.io.xml.dom.*
import matlab.io.xml.xpath.*
weboptions('Timeout',60)
data=webread("http://xxx/values.xml");
doc = parseString(Parser,data);
Output:
GetTankLevels
ans =
weboptions with properties:
CharacterEncoding: 'auto'
UserAgent: 'MATLAB 9.13.0.2085925 (R2022b) Update 1'
Timeout: 60
Username: ''
Password: ''
KeyName: ''
KeyValue: ''
ContentType: 'auto'
ContentReader: []
MediaType: 'auto'
RequestMethod: 'auto'
ArrayFormat: 'csv'
HeaderFields: []
CertificateFilename: 'default'
Error using webread
The connection to URL 'http://xxx/values.xml' timed out after 5.000 seconds. The reason is "Connection timeout after 5099 ms". Perhaps the server is not responding or
weboptions.Timeout needs to be set to a higher value.
댓글 수: 0
답변 (1개)
VINAYAK LUHA
2023년 10월 11일
편집: VINAYAK LUHA
2023년 10월 11일
Hi Tobias,
I understand that your "webread" request terminates with a timeout error despite explicitly setting the timeout time higher using the "weboptions" function.
Here is a solution to resolve the timeout error:
Further, I've also attached the code snippet for your better understanding:
options =weboptions('Timeout',60)
data=webread("http://xxx/values.xml",options);
I hope you find this solution helpful and the timeout error now stands resolved.
Regards,
Vinayak Luha
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Web Services에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!