Forum OpenACS Development: XML request Versus SOAP response

Posted by Iuri Sampaio on

Hi there, A third party webservice receives an XML post request and returns a SOAP response, rsrs!

Whether I like or not, I must parse that SOAP into OACS. Assuming that the idea of manipulating that SOAP structure manually is simply the worst and last option to choose, ...

what would be the best tool to manipulate that SOAP response?

  1. Perhaps TDOM?
  2. rl_json
  3. install xml-rpc
  4. Reusing OACS source in a customized pkg . Which pieces?

The samples of XML requests and SOAP responses are bellow

Best wishes, I

 #?xml version="1.0" encoding="UTF-8"?
  #OTA_VehAvailRateRQ# xmlns=""# 
 # ...#/OTA_VehAvailRateRQ#
#soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd=""##soap:Body##OTA_VehAvailRateRS Target="Test" xmlns="" xmlns:xsi="" xsi:schemaLocation="" SequenceNmbr="1" CorrelationID="0-0.88" PrimaryLangID="br" Version="5.000"##Success/#
Posted by Maurizio Martignano on
Is the following worth to be considered

Hope it helps,

Posted by Claudio Pasolini on
Hi Iuri,

I tried tclsoap many years ago, but in my opinion tsclws ( is a much better choice.

The only caveat is that if you have to call an existing web service you are limited to document/literal and rpc/encoded.



Posted by Russell Sorensen on
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:

You can see a service in action at:

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, and
# use is covered by their license.
<ws>namespace init ::openacs

# Initialize Schema
<ws>namespace schema ::openacs ""

### 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 {
} {
    return [list "$Email" "True"]
} returns {Email:openacs::email IsEmail:boolean}

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

<ws>proc ::openacs::CheckNaturalNumber {
} {
    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:

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.

Posted by Iuri Sampaio on
Hi all,
The service's in place already. It's a legacy from third parties, and I'm using OpenACS (i.e. a custom package), as middleware to intermediate the communication between webserver and frontend application.

I'm going to study tclws. That's for sure. Perhaps not in this case, because I've already started parsing SOAP schema, coverting it to a json format,delivering it to the frontend.

I'm defintely using tclws as a server in my next project, or as a third option for webservice's integration.
1. JSON i.e. a custom version from intranet-rest ]PO[
2. XML-RPC OpenACS pkg
3. and now TCLWS

Thanks guys for the advices!

Best wishes,