How do I call these web services in google script?
I've spent tens of hours on it: calling a web service from my school platform with google script. It works in php but not in google script. I don't know how to implement the "getClassList" method in the script. Everything tried nothing works! Please help me before I go completely crazy! I give you everything I think is necessary to write the script:
Webservices V3 (SOAP) URL's:
https://tisj-bilzen.smartschool.be/Webservices/V3
https://tisj-bilzen.smartschool.be/Webservices/V3?wsdl
Details of the methode:
getClassList
This method requests a list of all classes. This method provides a serialized array with the class name, description, visibility, and unique class code.
string $accesscode: Password webservices
getClassListJson
This method requests a list of all classes. This method provides a JSON array with the class name, description, visibility and unique class code.
string $accesscode: Password webservices
Password webservices : 408cb6c31db39698b176
Many thanks in advance !!
Patrick Crijns
one of my attempts :
function probeer5(){
var $code = '408cb6c31db39698b176';
var options = {"headers" : {"Authorization" : "accesscode:408cb6c31db39698b176>"} };
var url = "https://tisj-bilzen.smartschool.be/Webservices/V3?wsdl#getClassList";
var response = UrlFetchApp.fetch(url,options);
var result= response.getContentText();
Logger.log(result);
}
I'm trying to do the same thin on my school's smartschool.be-platform. Did you ever get this to work?
I've tried setting up a soap client like in this example!, but didn't get it to work for smartschool...
Update: I got it to work! Check out the demo code bolow, for the saveUserParameter method. I'm sure you'll be able to alter it to get the getClassList method to work as well. Don't forget to change my school prefix (msvoskenslaan) to yours (tisj-bilzen)!
function SS() {
var SSpass = "MySecretPassWord" //webservices PW
var sam = "fake.student" //user identifier (login or uniek ID)
var parameter = "extraInfo" //as this script calls the saveUserParameter webservice, this is the name of the parameter field which will be altered
var data = "Door script ingevoerde waarde met spaties \nen \nline \nbreaks." //the data entered in the field mentioned above
var xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="https://msvoskenslaan.smartschool.be:443/Webservices/V3" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ><SOAP-ENV:Body><mns:saveUserParameter xmlns:mns="https://msvoskenslaan.smartschool.be:443/Webservices/V3" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><accesscode xsi:type="xsd:string">' + SSpass + '</accesscode><userIdentifier xsi:type="xsd:string">' + sam + '</userIdentifier><paramName xsi:type="xsd:string">' + parameter + '</paramName><paramValue xsi:type="xsd:string">' + data + '</paramValue></mns:saveUserParameter></SOAP-ENV:Body></SOAP-ENV:Envelope>'
var options =
{
"method" : "post",
"contentType" : "text/xml; charset=utf-8",
"payload" : xml,
"muteHttpExceptions" : true
};
var soapCall= UrlFetchApp.fetch("https://msvoskenslaan.smartschool.be/Webservices/V3", options);
Logger.log(soapCall);
}