Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The correct code looks like this:</p> <pre><code>% createSoapMessage(NAMESPACE,METHOD,VALUES,NAMES,TYPES,STYLE) creates a SOAP message. message = createSoapMessage( ... 'http://www.webserviceX.NET', ... 'GetCitiesByCountry', ... {'Australia'}, ... {'CountryName'}, ... {'{http://www.w3.org/2001/XMLSchema}string' }, ... 'document') % callSoapService(ENDPOINT,SOAPACTION,MESSAGE) sends the MESSAGE, response = callSoapService( ... 'http://www.webservicex.net/GlobalWeather.asmx', ... 'http://www.webserviceX.NET/GetCitiesByCountry', ... message); % parseSoapResponse Convert the response from a SOAP server into MATLAB types. cities = parseSoapResponse(response) </code></pre> <p>The particular differences are:</p> <ul> <li>The STYLE parameter is 'document', not 'rpc'</li> <li>www.webservicex.net is very inconsistent in how they capitalize, and it matters!</li> <li>The endpoint parameter ends .asmx and does not inclcude ?WDSL.</li> </ul> <p>I have added an example of the <code>parseSoapResponse</code> call too. This also caused me trouble. For this web service, this call returns just the structure containing the requested data. When working with a different service on the same host, <code>parseSoapResponse</code> returned two outputs, a good/bad result and the data. See <a href="https://stackoverflow.com/questions/11220900/sending-soap-request-with-matlab">sending SOAP request with Matlab</a>.</p> <p>Finally, in answer to my supplementary question about viewing the intermediate XML such as <code>message</code>, the soap message, in MATLAB, use the following:</p> <pre><code> javaString = message.saveXML(message.getFirstChild()) </code></pre> <p>to get the XML in a java string and then:</p> <pre><code> matlabString = char(javaString) </code></pre> <p>to get the XML in a matlab string.</p> <p>The following code adds newlines and spaces to display the XML over several lines to help debugging.</p> <pre><code>ms2 = regexprep(matlabString ,'&gt;','&gt;\n') ms3 = regexprep(ms2,' x','\n x') </code></pre> <p>I still do not know how to view the outgoing and incoming HTTP traffic in MATLAB like you can in a browser.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload