Hans Karlsen (talk | contribs) No edit summary |
Hans Karlsen (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
SoapCall returns the body of the soap-envelope that is returned from the called service. | SoapCall returns the body of the soap-envelope that is returned from the called service. | ||
SoapCalls take a action (above 'GetQuote') and set this as SOAPAction header | SoapCalls take a action (above 'GetQuote') and set this as SOAPAction header, the action is also included in the request body. | ||
We build the soapEnvelope for the request with code like below - if you send in a action namespace we use it accordingly | |||
<pre> | <pre> | ||
Line 17: | Line 19: | ||
soapenvelopebuilder.Append(@" </nsAction:" + action + @">"); | soapenvelopebuilder.Append(@" </nsAction:" + action + @">"); | ||
soapenvelopebuilder.Append(" </soap:Body>"); | soapenvelopebuilder.Append(" </soap:Body>"); | ||
soapenvelopebuilder.Append("</soap:Envelope>"); | soapenvelopebuilder.Append("</soap:Envelope>");</pre>In the code above we see the parametersForSoapCall | ||
</pre> | |||
==== special variables ==== | ==== special variables ==== | ||
ViewModel variable named vSoapDebug – when we find this in the ViewModel – we assign the complete SoapEnvelope to this prior to sending it. | ViewModel variable named vSoapDebug – when we find this in the ViewModel – we assign the complete SoapEnvelope to this prior to sending it. |
Revision as of 07:44, 18 October 2019
Call SOAP service like this:
vNewVar:=selfVM.SoapCall('http://www.webserviceX.NET/stockquote.asmx','GetQuote','http://www.webserviceX.NET/','','','NestingWParams')
SoapCall returns the body of the soap-envelope that is returned from the called service.
SoapCalls take a action (above 'GetQuote') and set this as SOAPAction header, the action is also included in the request body.
We build the soapEnvelope for the request with code like below - if you send in a action namespace we use it accordingly
StringBuilder soapenvelopebuilder = new StringBuilder(); soapenvelopebuilder.Append(@"<?xml version = '1.0' encoding='utf-8' ?>"); soapenvelopebuilder.Append(@"<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">"); soapenvelopebuilder.Append(soapheaderbuilder); soapenvelopebuilder.Append(" <soap:Body " + @" xmlns:nsAction=""" + actionnamespace + @""">"); soapenvelopebuilder.Append(@" <nsAction:" + action + ">"); soapenvelopebuilder.Append(parametersForSoapCall); soapenvelopebuilder.Append(@" </nsAction:" + action + @">"); soapenvelopebuilder.Append(" </soap:Body>"); soapenvelopebuilder.Append("</soap:Envelope>");
In the code above we see the parametersForSoapCall
special variables
ViewModel variable named vSoapDebug – when we find this in the ViewModel – we assign the complete SoapEnvelope to this prior to sending it.