This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Send SOAP (Simple Object Access Protocol) message to endpoint

callSoapService will be removed in a future release. Use matlab.wsdl.createWSDLClient instead.


  • response = callSoapService(endpoint,soapAction,message)



response = callSoapService(endpoint,soapAction,message) sends message to the soapAction service at endpoint.


collapse all

Retrieve Book Information from Library Database

This example assumes the library is on a local intranet and does not use an actual endpoint; therefore, you cannot run it.

Retrieve the name of the author of a book titled "In the Fall." The relative path of the library service is urn:LibraryCatalog. To get the author's name, use the getAuthor function, which takes the book name as the input value. The getAuthor parameter is nameToLookUp. The XML data type for title is {}string. The SOAP message style is rpc by default.

Create the SOAP message.

message = createSoapMessage(...
  {'In the Fall'},...
message =
[#document: null]

This response does not necessarily indicate that the message is valid, although certain input problems produce error messages.

Send the message to the server for processing, and get the author's name back. The server endpoint is http://test/soap/services/LibraryCatalog. The server method is urn:LibraryCatalog#getAuthor.

response = callSoapService(...
<?xml version="1.0" encoding="utf-8"?>
<getAuthorResponse xmlns="urn:LibraryCatalog">
<ns1:getAuthorReturn xmlns:ns1="http://latestversion.soap.test">
Kate Alvin

MATLAB® returns the message in a single line, displayed here on separate lines for legibility.

Extract the author's name.

author = parseSoapResponse(response)
author = Kate Alvin

MATLAB automatically converted the XML string data type to char.

Input Arguments

collapse all

endpoint — URL identifying a built-in HTTP servicestring

URL identifying a built-in HTTP service, specified as a string.

Example: 'http://test/soap/services/LibraryCatalog'

soapAction — Name of servicestring

Name of service, specified as a string.

Example: 'urn:LibraryCatalog#getAuthor'

message — Java® document object model (DOM)string

Java document object model (DOM), specified as a string. Use createSoapMessage to create message.

Output Arguments

collapse all

response — Result of soapActionstring

Result of soapAction, returned as a string. To read information in response, use the parseSoapResponse function.

Introduced before R2006a

Was this topic helpful?