Skip To Main Content | Accessibility

Begin Main Content
Thread: XML request Versus SOAP response

Are you interested in using a client to interact with an existing service, or are you trying to setup a server on OpenACS to respond to client requests?

The best tcl client is tclws as mentioned by Claudio Pasolini. I think my server is better overall. The software is available on gitHub:

https://github.com/russell-todd-sorensen/twist

You can see a service in action at:
https://www.semitasker.com/twist/ws/openacs/

The file you write to create the above service is this (saved as index.tcl somewhere under pageroot):

#​ Examples Using OpenACS data types:
#​ Regular expressions were taken from openacs.org, and
#​ use is covered by their license.
<ws>namespace init ::openacs

#​ Initialize Schema
<ws>namespace schema ::openacs &#​34;https://www.semitasker.com/twist/ws/openacs/&#​34;

#​#​#​ Simple Types

#​ Phone
<ws>type pattern openacs::phone {^\(?([1-9][0-9]{2})\)?(-|\.|\ )?([0-9]{3})(-|\.|\ )?([0-9]{4})};

#​ Email
<ws>type pattern openacs::email  {^[^@\t ]+@[^@.\t]+(\.[^@.\n ]+)+$};

#​ NaturalNum
<ws>type pattern openacs::naturalNum {^(0*)(([1-9][0-9]*|0))$} xsd::integer

#​ Operations for the service:
<ws>proc ::openacs::CheckEmail {
    {Email:openacs::email}
} {
    return [list &#​34;$Email&#​34; &#​34;True&#​34;]
} returns {Email:openacs::email IsEmail:boolean}

<ws>proc ::openacs::CheckPhone {
    {Phone:openacs::phone}
} {
    return [list $Phone True]
} returns {Phone:openacs::phone IsPhone:boolean}

<ws>proc ::openacs::CheckNaturalNumber {
    {NaturalNumber:openacs::naturalNum}
} {
    return [list $NaturalNumber True]
} returns {NaturalNumber:openacs::naturalNum IsNaturalNum:boolean}

<ws>namespace finalize ::openacs

<ws>namespace freeze ::openacs

<ws>return ::openacs

Additional running examples are here:
https://www.semitasker.com/twist/ws/datetime/
https://www.semitasker.com/twist/ws/mywebservice/
https://www.semitasker.com/twist/ws/stockquoter/
https://www.semitasker.com/twist/ws/stockquoter2/

You will be limited to document/literal but I have been considering putting in a json to json adapter.

These example services also expose some of the client functionality. If you click on one of the operation links, you are presented with an auto-generated form. Fill out the form and it is sent as a GET request to the server. This is converted into a client SOAP/document/literal format and resubmitted to the same url as a POST. I never got around to exploiting this, but it would be relatively straightforward to create a proxy service.


Getting too much email? Manage your notifications at: https://openacs.org/notifications/manage


09:08 PM, 30 Jul 2019 by Iuri Sampaio Permalink

Add comment