필터 지우기
필터 지우기

Http Timeout webread not working

조회 수: 25 (최근 30일)
Tobias Wagner
Tobias Wagner 2022년 11월 7일
편집: VINAYAK LUHA 2023년 10월 11일
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.

답변 (1개)

VINAYAK LUHA
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:
  1. Create a "weboptions" object with timeout set to 60 seconds.
  2. Pass this created object as second parameter to the "webread" function
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

카테고리

Help CenterFile Exchange에서 Call Web Services from MATLAB Using HTTP에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by