SOAP: Difference between revisions

10,308 bytes added ,  3 months ago
m
(Added Wren)
m (→‎{{header|Wren}}: Minor tidy)
 
(4 intermediate revisions by 3 users not shown)
Line 5:
=={{header|ActionScript}}==
{{works with|ActionScript|3.0}}
<langsyntaxhighlight lang="actionscript">import mx.rpc.soap.WebService;
import mx.rpc.events.ResultEvent;
var ws:WebService = new WebService();
Line 20:
private function anotherSoapFunc_Result(event:ResultEvent):void {
// do another something
}</langsyntaxhighlight>
 
=={{header|AutoHotkey}}==
using embedded vb scripting.
{{libheader|ws4ahk}}
<langsyntaxhighlight AutoHotkeylang="autohotkey">WS_Initialize()
WS_Exec("Set client = CreateObject(""MSSOAP.SoapClient"")")
WS_Exec("client.MSSoapInit ""http://example.com/soap/wsdl""")
Line 35:
Msgbox % result . "`n" . result2
WS_Uninitialize()
#Include ws4ahk.ahk ; http://www.autohotkey.net/~easycom/ws4ahk_public_api.html</langsyntaxhighlight>
 
=={{header|C}}==
Although this is a generic task to show that calling SOAP functions are possible, the following implementation is geared for the real world. In order to execute it, just choose an actual WSDL URL and construct the input XML files for the functions properly, this can also be done in C but requires libraries like xerces unless you want to really construct the XML from scratch.
{{libheader|libcurl}}
<syntaxhighlight lang="c">
<lang C>
#include <curl/curl.h>
#include <string.h>
Line 95:
return 0;
}
</syntaxhighlight>
</lang>
Input XML for soapFunc()
<syntaxhighlight lang="xml">
<lang XML>
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Line 108:
</soapenv:Body>
</soapenv:Envelope>
</syntaxhighlight>
</lang>
Input XML for anotherSoapFunc()
<syntaxhighlight lang="xml">
<lang XML>
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Line 121:
</soapenv:Body>
</soapenv:Envelope>
</syntaxhighlight>
</lang>
 
=={{header|Clojure}}==
<langsyntaxhighlight lang="clojure">(require '[clj-soap.core :as soap])
 
(let [client (soap/client-fn "http://example.com/soap/wsdl")]
(client :soapFunc)
(client :anotherSoapFunc))</langsyntaxhighlight>
 
=={{header|ColdFusion}}==
<langsyntaxhighlight lang="cfm"><cfset client = createObject("webservice","http://example.com/soap/wsdl")>
<cfset result = client.soapFunc("hello")>
<cfset result = client.anotherSoapFunc(34234)></langsyntaxhighlight>
 
=={{header|Diego}}==
<syntaxhighlight lang="diego">apt_knowledge(webservices); // Commanding apt_protocol(SOAP); will also apt_knowledge(webservices);
 
set_namespace(rosettacode);
 
add_webserv(ws)_protocol(SOAP)_wdsl(http://example.com/soap/wsdl)_me();
invoke_webserv(ws)_soapFunc(hello)_msg()_result()_me();
me_msg()_invoke(ws)_anotherSoapFunc(32234); // alternative syntax
 
reset_namespace();</syntaxhighlight>
 
=={{header|F Sharp|F#}}==
The availability of functions and the type of parameters is checked at compile time. The development environment supports auto-completion and parameter information just like for regular types.
 
<langsyntaxhighlight lang="fsharp">open Microsoft.FSharp.Data.TypeProviders
 
type Wsdl = WsdlService<"http://example.com/soap/wsdl">
let result = Wsdl.soapFunc("hello")
let result2 = Wsdl.anotherSoapFunc(34234)</langsyntaxhighlight>
 
=={{header|Go}}==
Line 148 ⟶ 159:
<br>
To make this example a bit more interesting we test against a publicly available working SOAP server at the date of posting.
<langsyntaxhighlight lang="go">package main
 
import (
Line 200 ⟶ 211:
fmt.Println("Name : ", rv.Name)
fmt.Println("Address : ", rv.Address)
}</langsyntaxhighlight>
 
{{out}}
Line 216 ⟶ 227:
 
This code uses Unicon features not available in Icon.
<langsyntaxhighlight lang="unicon">import soap
 
procedure main(A)
Line 222 ⟶ 233:
write("soapFunc: ",soap.call("soapFunc"))
write("anotherSoapFunc: ",soap.call("anotherSoapFunc"))
end</langsyntaxhighlight>
 
A matching SOAP server can be implemented as:
 
<langsyntaxhighlight lang="unicon">import soap
 
procedure main()
Line 245 ⟶ 256:
every (s := " ") ||:= (!A || " ")
return "Goodbye" || s[1:-1]
end</langsyntaxhighlight>
 
=={{header|Julia}}==
{{trans|C}}
<langsyntaxhighlight lang="julia">using LibCURL
 
function callSOAP(url, infilename, outfilename)
Line 280 ⟶ 291:
println("Usage : $(@__FILE__) <URL of WSDL> <Input file path> <Output File Path>")
end
</syntaxhighlight>
</lang>
 
=={{header|Kotlin}}==
Line 293 ⟶ 304:
</pre>
Next, you need to compile the following Kotlin program, linking against libcurl.klib.
<langsyntaxhighlight lang="scala">// Kotlin Native v0.6
 
import kotlinx.cinterop.*
Line 351 ⟶ 362:
}
callSOAP(args[0], args[1], args[2])
}</langsyntaxhighlight>
Finally, the resulting .kexe file should be executed passing it similar command line arguments to the C entry.
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<langsyntaxhighlight Mathematicalang="mathematica">InstallService["http://example.com/soap/wsdl"];
soapFunc["Hello"];
anotherSoapFunc[12345];</langsyntaxhighlight>
 
=={{header|Perl}}==
{{libheader|SOAP::Lite}}
<langsyntaxhighlight lang="perl">use SOAP::Lite;
 
print SOAP::Lite
Line 368 ⟶ 379:
print SOAP::Lite
-> service('http://example.com/soap/wsdl')
-> anotherSoapFunc(34234);</langsyntaxhighlight>
 
=={{header|Phix}}==
{{libheader|Phix/libcurl}}
<!--<syntaxhighlight lang="phix">(notonline)-->
translated from https://gist.github.com/p120ph37/8281362ae9da042f3043
<span style="color: #000080;font-style:italic;">--
<lang Phix>-- demo\rosetta\SOAP.exw
-- demo\rosetta\SOAP.exw
include builtins\libcurl.e
-- =====================
include builtins\xml.e -- xml_encode()
--
-- translated from https://gist.github.com/p120ph37/8281362ae9da042f3043
--</span>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (libcurl)</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">builtins</span><span style="color: #0000FF;">\</span><span style="color: #000000;">libcurl</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">builtins</span><span style="color: #0000FF;">\</span><span style="color: #000000;">xml</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span> <span style="color: #000080;font-style:italic;">-- xml_encode()</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">write_callback</span><span style="color: #0000FF;">(</span><span style="color: #004080;">atom</span> <span style="color: #000000;">pData</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">integer</span> <span style="color: #000000;">size</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">nmemb</span><span style="color: #0000FF;">,</span> <span style="color: #004080;">atom</span> <span style="color: #000080;font-style:italic;">/*pUserdata*/</span><span style="color: #0000FF;">)</span>
<span style="color: #004080;">integer</span> <span style="color: #000000;">bytes_written</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">size</span><span style="color: #0000FF;">*</span><span style="color: #000000;">nmemb</span>
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #7060A8;">peek</span><span style="color: #0000FF;">({</span><span style="color: #000000;">pData</span><span style="color: #0000FF;">,</span><span style="color: #000000;">bytes_written</span><span style="color: #0000FF;">}))</span>
<span style="color: #008080;">return</span> <span style="color: #000000;">bytes_written</span>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<span style="color: #008080;">constant</span> <span style="color: #000000;">write_cb</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">call_back</span><span style="color: #0000FF;">({</span><span style="color: #008000;">'+'</span><span style="color: #0000FF;">,</span><span style="color: #000000;">write_callback</span><span style="color: #0000FF;">})</span>
<span style="color: #008080;">function</span> <span style="color: #000000;">compose_soap_frobnicate</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">foo</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">bar</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">baz</span><span style="color: #0000FF;">)</span>
function write_callback(atom pData, integer size, integer nmemb, atom /*pUserdata*/)
<span style="color: #008080;">return</span> <span style="color: #7060A8;">sprintf</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"""
integer bytes_written = size*nmemb
&lt;?xml version="1.0" encoding="utf-8"?&gt;
puts(1,peek({pData,bytes_written}))
&lt;soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
return bytes_written
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
end function
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
constant write_cb = call_back({'+',routine_id("write_callback")})
&lt;soap:Body&gt;
 
&lt;frobnicate xmlns="http://example.com/frobnicate"&gt;
function compose_soap_frobnicate(string foo, bar, baz)
&lt;foo&gt;%s&lt;/foo&gt;
return sprintf("""
&lt;bar&gt;%s&lt;/bar&gt;
<?xml version="1.0" encoding="utf-8"?>
&lt;baz&gt;%s&lt;/baz&gt;
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
&lt;/frobnicate&gt;
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
&lt;/soap:Body&gt;
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
&lt;/soap:Envelope&gt;"""</span><span style="color: #0000FF;">,{</span><span style="color: #000000;">xml_encode</span><span style="color: #0000FF;">(</span><span style="color: #000000;">foo</span><span style="color: #0000FF;">),</span><span style="color: #000000;">xml_encode</span><span style="color: #0000FF;">(</span><span style="color: #000000;">bar</span><span style="color: #0000FF;">),</span><span style="color: #000000;">xml_encode</span><span style="color: #0000FF;">(</span><span style="color: #000000;">baz</span><span style="color: #0000FF;">)})</span>
<soap:Body>
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
<frobnicate xmlns="http://example.com/frobnicate">
<foo>%s</foo>
<span style="color: #7060A8;">curl_global_init</span><span style="color: #0000FF;">()</span>
<bar>%s</bar>
<span style="color: #004080;">atom</span> <span style="color: #000000;">curl</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">curl_easy_init</span><span style="color: #0000FF;">()</span>
<baz>%s</baz>
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #004600;">CURLOPT_URL</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"https://ameriwether.com/cgi-bin/info.pl"</span><span style="color: #0000FF;">)</span>
</frobnicate>
<span style="color: #004080;">string</span> <span style="color: #000000;">soap</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">compose_soap_frobnicate</span><span style="color: #0000FF;">(</span><span style="color: #008000;">"'Ein'"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"&gt;Zwei&lt;"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"\"Drei\""</span><span style="color: #0000FF;">)</span>
</soap:Body>
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">CURLOPT_POSTFIELDS</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">soap</span><span style="color: #0000FF;">)</span>
</soap:Envelope>""",{xml_encode(foo),xml_encode(bar),xml_encode(baz)})
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">CURLOPT_HTTPAUTH</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">CURLAUTH_BASIC</span><span style="color: #0000FF;">)</span>
end function
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #004600;">CURLOPT_USERNAME</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"user"</span><span style="color: #0000FF;">)</span>
 
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #004600;">CURLOPT_PASSWORD</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"password"</span><span style="color: #0000FF;">)</span>
curl_global_init()
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #004600;">CURLOPT_WRITEFUNCTION</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">write_cb</span><span style="color: #0000FF;">)</span>
atom curl = curl_easy_init()
<span style="color: #004080;">atom</span> <span style="color: #000000;">headers</span> <span style="color: #0000FF;">=</span> <span style="color: #004600;">NULL</span>
curl_easy_setopt(curl, CURLOPT_URL, "https://ameriwether.com/cgi-bin/info.pl")
<span style="color: #000000;">headers</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">curl_slist_append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">headers</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Content-Type: text/xml; charset=utf-8"</span><span style="color: #0000FF;">)</span>
string soap = compose_soap_frobnicate("'Ein'", ">Zwei<", "\"Drei\"")
<span style="color: #000000;">headers</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">curl_slist_append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">headers</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"SOAPAction: \"https://ameriwether.com/cgi-bin/info.pl/frobnicate\""</span><span style="color: #0000FF;">)</span>
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, soap)
<span style="color: #000000;">headers</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">curl_slist_append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">headers</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"Accept: text/plain"</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- Example output easier to read as plain text.</span>
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC)
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">CURLOPT_HTTPHEADER</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">headers</span><span style="color: #0000FF;">)</span>
curl_easy_setopt(curl, CURLOPT_USERNAME, "user")
<span style="color: #000080;font-style:italic;">-- Make the example URL work even if your CA bundle is missing.</span>
curl_easy_setopt(curl, CURLOPT_PASSWORD, "password")
<span style="color: #7060A8;">curl_easy_setopt</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">,</span> <span style="color: #004600;">CURLOPT_SSL_VERIFYPEER</span><span style="color: #0000FF;">,</span> <span style="color: #004600;">false</span><span style="color: #0000FF;">)</span>
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb)
<span style="color: #004080;">CURLcode</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">curl_easy_perform</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">)</span>
atom headers = NULL
<span style="color: #008080;">if</span> <span style="color: #000000;">res</span><span style="color: #0000FF;">!=</span><span style="color: #004600;">CURLE_OK</span> <span style="color: #008080;">then</span>
headers = curl_slist_append(headers, "Content-Type: text/xml; charset=utf-8")
<span style="color: #7060A8;">printf</span><span style="color: #0000FF;">(</span><span style="color: #000000;">2</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"curl_easy_perform() failed: %s\n"</span><span style="color: #0000FF;">,</span> <span style="color: #7060A8;">curl_easy_strerror</span><span style="color: #0000FF;">(</span><span style="color: #000000;">res</span><span style="color: #0000FF;">))</span>
headers = curl_slist_append(headers, "SOAPAction: \"https://ameriwether.com/cgi-bin/info.pl/frobnicate\"")
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span>
headers = curl_slist_append(headers, "Accept: text/plain") -- Example output easier to read as plain text.
<span style="color: #7060A8;">curl_slist_free_all</span><span style="color: #0000FF;">(</span><span style="color: #000000;">headers</span><span style="color: #0000FF;">)</span>
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers)
<span style="color: #7060A8;">curl_easy_cleanup</span><span style="color: #0000FF;">(</span><span style="color: #000000;">curl</span><span style="color: #0000FF;">)</span>
-- Make the example URL work even if your CA bundle is missing.
<span style="color: #7060A8;">curl_global_cleanup</span><span style="color: #0000FF;">()</span>
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false)
<!--</syntaxhighlight>-->
CURLcode res = curl_easy_perform(curl)
if res!=CURLE_OK then
printf(2, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res))
end if
curl_slist_free_all(headers)
curl_easy_cleanup(curl)
curl_global_cleanup()</lang>
{{out}}
note: foo/bar/baz are shown properly escaped on the terminal.
Line 463 ⟶ 481:
=={{header|PHP}}==
{{works with|PHP|5.0.0+}}
<langsyntaxhighlight lang="php"><?php
//load the wsdl file
$client = new SoapClient("http://example.com/soap/definition.wsdl");
Line 476 ⟶ 494:
//list if SOAP Functions
print_r($client->__getFunctions());
?></langsyntaxhighlight>
 
=={{header|PureBasic}}==
<syntaxhighlight lang="purebasic">
<lang Purebasic>
XIncludeFile "COMatePLUS.pbi"
Define.COMateObject soapObject = COMate_CreateObject("MSSOAP.SoapClient")
Line 485 ⟶ 503:
result = soapObject\Invoke("soapFunc('hello')")
result2 = soapObject\Invoke("anotherSoapFunc(34234)")
</syntaxhighlight>
</lang>
 
=={{header|Python}}==
{{works with|Python|2.4 and 2.5}}
<langsyntaxhighlight lang="python">from SOAPpy import WSDL
proxy = WSDL.Proxy("http://example.com/soap/wsdl")
result = proxy.soapFunc("hello")
result = proxy.anotherSoapFunc(34234)</langsyntaxhighlight>
 
'''Note:''' SOAPpy is a third-party module and can be found at [http://pywebsvcs.sourceforge.net/ Python Web Services]
Line 498 ⟶ 516:
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang="raku" perl6line># Reference:
# https://github.com/retupmoca/P6-SOAP
# http://wiki.dreamfactory.com/DreamFactory/Tutorials/Temp_Conversion_SOAP_API
Line 509 ⟶ 527:
say $request.call('CelsiusToFahrenheit', Celsius => 100 ) or die;
 
say $request.call('FahrenheitToCelsius', Fahrenheit => 212 ) or die;</langsyntaxhighlight>
{{out}}
<pre>{CelsiusToFahrenheitResult => [212]}
Line 517 ⟶ 535:
=={{header|Ruby}}==
{{works with|Ruby|1.8}}
<langsyntaxhighlight lang="ruby">require 'soap/wsdlDriver'
 
wsdl = SOAP::WSDLDriverFactory.new("http://example.com/soap/wsdl")
Line 526 ⟶ 544:
 
response2 = soap.anotherSoapFunc(:aNumber => 42)
puts response2.anotherSoapFuncReturn</langsyntaxhighlight>
 
=={{header|Smalltalk}}==
{{works with|Smalltalk/X}} {{works with|Dolphin Smalltalk}} (not sure about Pharo and VW)
(assuming that the open source [http://www.mars.dti.ne.jp/~umejava/smalltalk/soapOpera/index.html SOAPSpray] package has been loaded.)
<langsyntaxhighlight lang="smalltalk">| service client response1 response2 |
 
service := SprayWSDLService onUrl: 'http://example.com/soap/wsdl'.
Line 537 ⟶ 555:
client := service createClient.
response1 := client send: 'soapFunc' withArguments:{ 'hello' }.
response2 := client send: 'anotherSoapFunc' withArguments:{ 34234 }.</langsyntaxhighlight>
 
=={{header|Tcl}}==
{{works with|Tcl|8.5+}}
Uses the <code>[http://code.google.com/p/tclws/ tclws]</code> package.
<langsyntaxhighlight Tcllang="tcl">package require WS::Client
 
# Grok the service, and generate stubs
Line 550 ⟶ 568:
# Do the calls
set result1 [ExampleService::soapFunc "hello"]
set result2 [ExampleService::anotherSoapFunc 34234]</langsyntaxhighlight>
 
=={{header|Uniface}}==
Assuming http://example.com/soap/wsdl has been imported into repository and, as result, exists a new component called "webservice"
 
<syntaxhighlight lang="uniface">
<lang Uniface>
variables
string result1, result2
Line 562 ⟶ 580:
activate "webservice".soapFunc("hello", result1)
activate "webservice".anotherSoapFunc(34234, result2)
</syntaxhighlight>
</lang>
 
=={{header|VBScript}}==
 
<langsyntaxhighlight lang="vbscript">Dim client
Dim result
Set client = CreateObject("MSSOAP.SoapClient")
client.MSSoapInit "http://example.com/soap/wsdl"
result = client.soapFunc("hello")
result = client.anotherSoapFunc(34234)</langsyntaxhighlight>
 
=={{header|Visual Objects}}==
 
<langsyntaxhighlight lang="visobj">LOCAL oSoapClient AS OBJECT //OLEAUTOOBJECT
LOCAL cUrl AS STRING
LOCAL uResult AS USUAL
Line 584 ⟶ 602:
uResult := oSoapClient:soapFunc("hello")
uResult := oSoapClient:anotherSoapFunc(34234)
ENDIF</langsyntaxhighlight>
 
=={{header|Wren}}==
Line 590 ⟶ 608:
{{libheader|libcurl}}
An embedded program so we can ask the C host to communicate with libcurl for us.
<langsyntaxhighlight ecmascriptlang="wren">/* soapSOAP.wren */
 
var CURLOPT_URL = 10002
Line 656 ⟶ 674:
}
 
soap.call(File.url, File.readFile, File.writeFile)</langsyntaxhighlight>
<br>
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">/* gcc SOAP.c -o SOAP -lcurl -lwren -lm */
<lang c>#include <stdio.h>
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Line 834 ⟶ 854:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "soapSOAP.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 850 ⟶ 870:
free(script);
return 0;
}</langsyntaxhighlight>
 
{{omit from|Batch File|Does not have network access.}}
9,476

edits