| MATLAB® | ![]() |
| On this page… |
|---|
At the time of this writing, Web service technologies continue to evolve and change. The following list contains possible limitations to consider before building MATLAB applications with Web services:
The majority of Web services are made available via HTTP. Like the Internet itself, quality of service cannot be guaranteed. Therefore, your application performance might suffer or might appear unreliable.
Web services and the related technologies like WSDL and SOAP are relatively new. As with any new technology, established procedures and best practices are still being written.
If you plan to call remote Web services, make sure you validate their accuracy and reliability. Also, Web services that are free today might not remain free in the future.
Because the Internet is inherently unpredictable, make sure to take proper precautions in programming with Web services. One way to minimize the risk is to use common program control and error-handling routines.
Common programming techniques you might use include
Try - Catch statements can catch errors that result from method calls as well as creating the MATLAB class from the WSDL. The following example shows a method call in a try - catch statement:
try r = getRate(CurrencyExchangeService, 'USA', 'France'); catch r = Nan; disp(lasterr); end
If statements can check that expressions or statements are true or false. For example, if you have a valid URL and WSDL file, such as:
wsdlUrl = ['http://www.xmethods.net/sd/2001' ...
'/CurrencyExchangeService.wsdl'];
wsdlFile = 'CurrencyExchangeService.wsdl';the following if statement caches the WSDL locally:
if ~(exist(wsdlFile,'file') == 2)
urlwrite(wsdlUrl,wsdlFile);
end
Error functions can be used to throw specific errors. The following example shows an error function used in an try - catch statement:
try
r = getRate(CurrencyExchangeService, 'USA', 'France');
catch
error('Could not return exchange rate');
end
For more information about program control and error-handling statements, see the MATLAB Programming Fundamentals documentation.
![]() | Using Web Services in MATLAB Applications | Serial Port I/O | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |