You are here

CS : Adding New Webservices

Submitted by admin on Mon, 09/07/2009 - 11:05


We use Sakai - and if you know what you're doing (and sometimes even if you don't) you can add new SOAP calls, enabling you to write scripts to manipulate the system, and run maintenience.

There are a couple APIs that are exposed in Luminis via SOAP, the Targeted Announcement API comes to mind, simply because I've used it.

Has anyone use any of the other APIs, and/or created new SOAP calls ?

I would LOVE some user APIs - sililar to -

cptool list user xxxxx -a

cptool set user xxxxx yyyyy='zzzzz'

cptool list sessions (-c)

extensible services like would make manageing the system much more enjoyable.

thoughts ?



Luminis Version:

What's the Targeted Announcement API and how can I find some good examples of it in use and some technical documentation on how to "get at it" ?


In my experience, documentation on this subject is very limited.

One of our ColdFusion developers wrote a CF component that publishes targeted announcements using the SOAP API.  He allowed me to share his code:

    <cffunction name="fLumTAAPI" access="public" returntype="any">
        <cfargument name="LumWSDL" type="string" required="yes">
        <cfargument name="mSubject" type="string" required="yes">
        <cfargument name="mBody" type="string" required="yes">
        <cfargument name="Recipients" type="array" required="yes">
        <cfargument name="Expiration" type="date" required="no">
        <cfargument name="username" type="string" required="yes">
        <cfargument name="password" type="string" required="yes">
        <cfif isDefined('arguments.Expiration')>
            <cfset dTime = #arguments.Expiration#>
            <cfset xmlTime = dateformat(dTime, 'yyyy-mm-dd') & 'T' & timeformat(dTime, 'HH:mm:ss')>
            <!---From CFC - <cfdump var="#xmlTime#">--->
            <cfsavecontent variable="localscope.soapRequest">
                <?xml version="1.0" encoding="UTF-8"?>
                    <soapenv:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soapenv="" xmlns:urn="" xmlns:soapenc="">
                         <urn:sendMessage soapenv:encodingStyle="">
                            <message xsi:type="urn:NewMessage" xmlns:urn="">
                               <recipients xsi:type="urn:ArrayOfRecipient" soapenc:arrayType="urn:Recipient[]">
                                    <cfloop from="1" to="#arraylen(arguments.Recipients)#" index="i">
                               <deliveryAgent xsi:type="urn:DeliveryAgent">PORTAL</deliveryAgent>
                               <subject xsi:type="xsd:string">#arguments.mSubject#</subject>
                               <body xsi:type="xsd:string">#arguments.mBody#</body>
                               <cfif isDefined('arguments.Expiration')><expirationDateTime xsi:type="xsd:dateTime">#xmlTime#</expirationDateTime></cfif>
            <cfhttp url="#arguments.LumWSDL#" resolveurl="NO" port="80" username="#arguments.username#" password="#arguments.password#" method="post">
                    <cfhttpparam type="header" name="SOAPAction" value="">
                    <cfhttpparam type="header" name="content-type" value="text/xml">
                    <cfhttpparam type="header" name="charset" value="utf-8">
                    <cfhttpparam type="header" name="Content-Length" value="#len(trim(localscope.soapRequest))#">
                    <cfhttpparam type="xml" name="body" value="#trim(localscope.soapRequest)#">
        <!---<cfdump var="#cfhttp.FileContent#">--->
        <cfreturn xmlParse(cfhttp.FileContent)>


This component takes the WSDL address, subject, body and other variables as parameters, generates the SOAP XML and sends it over a http request.  You don't need to do anything to enable this service on the Luminis side except for create an account with admin permissions with which you can submit the SOAP request.  The WSDL file you need to submit the request to is at

I hope this helps.  Let me know if I can clarify/help further.

Vladimir Mollov