Main Content

matlab.wsdl.createWSDLClient

Create interface to SOAP-based web service

Description

example

matlab.wsdl.createWSDLClient(wsdlURL) creates an interface to a service based on a Web Services Description Language (WSDL) document specified by wsdlURL. This function creates a MATLAB® class file for each Simple Object Access Protocol (SOAP) binding in the WSDL in the current folder. If necessary, the function creates additional support files. You can package and distribute these files to other users.

You must install the WSDL tools, Java® JDK™ and Apache® CXF software, then set the tool paths using the matlab.wsdl.setWSDLToolPath function.

You must have write permission for the current folder.

matlab.wsdl.createWSDLClient(wsdlURL,folder) creates the interface files in folder, which must be on the MATLAB path.

matlab.wsdl.createWSDLClient(wsdlURL,folder,'silent') suppresses display of generated files and folders.

matlab.wsdl.createWSDLClient(___,options) specifies additional information needed to access the WSDL document. You can use this syntax with any of the input arguments of the previous syntaxes.

classname = matlab.wsdl.createWSDLClient(___) returns a handle to the created class. If multiple classes were created, the function returns a cell array of handles. You can use this syntax with any of the input arguments of the previous syntaxes.

To get information on using the class, call the MATLAB help function on the class name.

Examples

collapse all

To run this example, install the WSDL tools and set the tool paths. jdk and cxf are the paths to these tools on your system.

matlab.wsdl.setWSDLToolPath('JDK',jdk,'CXF',cxf)

Create the class files.

url = ...
'http://basemap.nationalmap.gov/arcgis/services/USGSImageryOnly/MapServer?wsdl';
matlab.wsdl.createWSDLClient(url)
Created USGSImageryOnly_MapServer.
  .\USGSImageryOnly_MapServer.m
  .\+wsdl

In order to use USGSImageryOnly_MapServer, you must run javaaddpath('.\+wsdl\mapserver.jar').

Add the jar files to the Java path.

javaaddpath('.\+wsdl\mapserver.jar')

Create the service.

wsdl = USGSImageryOnly_MapServer;

Read help for the service and its functions.

help USGSImageryOnly_MapServer
USGSImageryOnly_MapServer   A client to connect to the USGSImageryOnly_MapServer service
     SERVICE = USGSImageryOnly_MapServer  connects to http://basemap.nationalmap.gov/arcgis/services/USGSImageryOnly/MapServer and returns a SERVICE.
     
     To communicate with the service, call a function on the SERVICE:
 
        [...] = FUNCTION(SERVICE,arg,...) 
 
     See doc USGSImageryOnly_MapServer for a list of functions.

Call one of the methods, for example GetDefaultMapName that returns the map name.

GetDefaultMapName(wsdl)
ans =

Layers

Input Arguments

collapse all

WSDL URL or file path, specified as a string or a character vector, that defines service methods, arguments, and transactions.

wsdlURL can be an http or https URL or a local path. wsdlURL cannot be a file:// URL. On Microsoft® Windows®, UNC paths are not supported.

Example: 'http://www.mywebservice.com/servicename?WSDL'

Folder for generated files, specified as a string or a character vector. If omitted or empty (''), matlab.wsdl.createWSDLClient uses the current folder. You must have write permission for the folder. The function overwrites existing files with the same names as the generated files.

Example: 'c:\work'

Additional options, specified as a weboptions object, needed to access the WSDL document, such as Username, Password, and Timeout.

The additional options specified in weboptions do not apply to any other documents, such as other imported WSDL documents or schemas, that the primary WSDL document references. The options also do not apply to requests made to servers by the generated code.

Example: 'Username','john','Password','mypassword'

Tips

  • If you create WSDL files in multiple locations on your computer, avoid confusion by deleting the class files from duplicate locations, and then call clear java.

Version History

Introduced in R2014b