This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

TESA Assa Abloy SOAP API
#1
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.

Attached Files
.pdf   SMARTAIR SOAP API rev10 (002).pdf (Size: 963.64 KB / Downloads: 75)
Reply
#2
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)
Reply
#3
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'
Reply


Forum Jump: