Logic Machine Forum
TESA Assa Abloy SOAP API - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: TESA Assa Abloy SOAP API (/showthread.php?tid=2603)



TESA Assa Abloy SOAP API - pentadom - 21.04.2020

Hello,

I need to do an integration with a TESA Assa Abloy locks system via SOAP API.

I want to know when opens the lock and when close the lock. With this information I will turn on the lights when the lock opens and I will turn off the lights when the lock closes.

Can anybody help me with this? I never did a work like this before with Logic Machine.

I attach the API.


RE: TESA Assa Abloy SOAP API - admin - 21.04.2020

Try this example, change host and parameters inside body variable as needed. Keep in mind that for other services like users you need to change service variable according to the documentation.
Code:
function soaprequest(host, service, body)
  local ltn12 = require('ltn12')
  local https = require('ssl.https')
  local sink = {}

  local res, err = https.request({
    url = 'https://' .. host .. ':8181/ServerPlatform/' .. service,
    method = 'POST',
    headers = {
      ['Content-Length'] = #body,
    },
    sink = ltn12.sink.table(sink),
    source = ltn12.source.string(body),
  })

  if res then
    return table.concat(sink)
  else
    return nil, err
  end
end

host = '192.168.1.1'
service = 'DoorsWebService'
body = [[<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.ws.ts1000.tesa.es/">
<soapenv:Header/>
<soapenv:Body>
<soap:doorClose>
<operatorName>operator1</operatorName>
<operatorPassword>myPassword1</operatorPassword>
<doorName>door1</doorName>
</soap:doorClose>
</soapenv:Body>
</soapenv:Envelope>]]

res, err = soaprequest(host, service, body)
log(res, err)



RE: TESA Assa Abloy SOAP API - ffrr12 - 07.07.2023

Hi!

I've begun to use the same SMARTAIR SOAP API with PowerShell but always receiving the error: "Invoke-WebRequest : The remote server returned an error: (415) Unsupported Media Type.". For example with the following code:

Code:
$Body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.ws.ts1000.tesa.es/">
<soapenv:Header/>
<soapenv:Body>
<soap:lockingPlanModify>
<operatorName>user</operatorName>
<operatorPassword>XXXXXX</operatorPassword>
<userId>274</userId>
<doorId>118</doorId>
<canOpen>true</canOpen>
<codTimetable>15</codTimetable>
<privacyOverride>true</privacyOverride>
</soap:lockingPlanModify>
</soapenv:Body>
</soapenv:Envelope>'
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$Response = Invoke-WebRequest -Uri 'https://localhost:8181/TesaSmartairPlatform/LockingPlanWebService' -Method Post -Body $Body

Any help will be appreciated.

Regards, Fernando.

Solved!!  :D

I had got to add -ContentType 'text/xml' in Invoke-WebRequest

Code:
Invoke-WebRequest -Uri 'https://localhost:8181/TesaSmartairPlatform/LockingPlanWebService' -Method 'Post' -Body $Body -ContentType 'text/xml'