SOAP: Difference between revisions

Content added Content deleted
No edit summary
Line 45: Line 45:


After importing the <tt>soap</tt> package from the [https://tapestry.tucson.az.us/unilib Unicon Code Library] this can be done with:
After importing the <tt>soap</tt> package from the [https://tapestry.tucson.az.us/unilib Unicon Code Library] this can be done with:
<lang Unicon>import soap
<lang unicon>import soap


procedure main(A)
procedure main(A)
Line 51: Line 51:
write("soapFunc: ",soap.call("soapFunc"))
write("soapFunc: ",soap.call("soapFunc"))
write("anotherSoapFunc: ",soap.call("anotherSoapFunc"))
write("anotherSoapFunc: ",soap.call("anotherSoapFunc"))
end</lang>

A matching SOAP server can be implemented as:

<lang unicon>import soap

procedure main()
server := SoapServer("http://example.com/soap/wsdl")
server.addService("soapFunc", soapFunc)
server.addService("anotherSoapFunc", anotherSoapFunc)
msg := server.handleRequest()
write(msg)
exit(0)
end

procedure soapFunc(A[])
every (s := " ") ||:= (!A || " ")
return "Hello" || s[1:-1]
end

procedure anotherSoapFunc(A[])
every (s := " ") ||:= (!A || " ")
return "Goodbye" || s[1:-1]
end</lang>
end</lang>