Добавил, появилась кнопка, нажимаю на кнопку, появляется ошибка:
Цитата:
connection 08-03/10:13:47 INFO [sa-p-7-t-28] DeviceManageWorker - Do task invDeviceId: 2; Event[ru.bitel.bgbilling.modules.tv.access.manage.event.TvDeviceManageEvent] moduleId: 10; pluginId: no; cid: global; scid: -1; userId: 1; deviceId: 2; operation: terminalsSynchronize; timestamp: 1470186827422
connection 08-03/10:13:47 INFO [sa-p-7-t-28] DeviceManageWorker - Processing invDeviceId:2; command terminalsSynchronize
connection 08-03/10:13:47 INFO [sa-p-7-t-28] IptvPortalDeviceManager - terminalsSynchronize
connection 08-03/10:13:47 INFO [sa-p-7-t-28] JsonClient - post:
https://***.iptvportal.ru:443/api/jsonsql/connection 08-03/10:13:47 INFO [sa-p-7-t-28] JsonClient - >> {"method":"select","id":1,"jsonrpc":"2.0","params":{"data":["id","mac_addr","inet_addr","disabled"],"from":"terminal","where":{"eq":["subscriber_id","1415892"]}}}
connection 08-03/10:13:49 INFO [sa-p-7-t-28] JsonClient - Response code = 401
connection 08-03/10:13:49 ERROR [sa-p-7-t-28] Consumer - java.io.IOException: Stream closed
ru.bitel.bgbilling.common.BGException: java.io.IOException: Stream closed
at ru.bitel.bgbilling.modules.tv.access.manage.DeviceManageWorker.doTask(DeviceManageWorker.java:223)
at ru.bitel.bgbilling.kernel.event.EventWorker.notify(EventWorker.java:259)
at ru.bitel.bgbilling.kernel.event.Consumer.onMessage0(Consumer.java:112)
at ru.bitel.bgbilling.kernel.event.EventWorker.internalDoTask(EventWorker.java:229)
at ru.bitel.bgbilling.kernel.event.EventWorker.doTasks(EventWorker.java:208)
at ru.bitel.bgbilling.modules.tv.access.manage.DeviceManageWorker.runWorker(DeviceManageWorker.java:165)
at ru.bitel.bgbilling.kernel.event.EventWorker.internalRunWorker(EventWorker.java:139)
at ru.bitel.bgbilling.modules.tv.access.manage.DeviceManageWorker.runImpl(DeviceManageWorker.java:105)
at ru.bitel.common.worker.WorkerTask.run(WorkerTask.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ru.bitel.common.worker.WorkerThread.run(WorkerThread.java:46)
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:159)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at ru.bitel.common.Utils.readByBlock(Utils.java:1332)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.requestImpl0(JsonClient.java:223)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.requestImpl(JsonClient.java:242)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.invoke(JsonClient.java:320)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalJsonClient.invoke(IptvPortalJsonClient.java:102)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalJsonClient.invoke(IptvPortalJsonClient.java:84)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalJsonClient.select(IptvPortalJsonClient.java:241)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalTerminalSynchronizingTask.processAccount(IptvPortalTerminalSynchronizingTask.java:151)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalDeviceManager.terminalsSynchronize(IptvPortalDeviceManager.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at ru.bitel.bgbilling.modules.tv.access.manage.DeviceManageWorker.doCommand(DeviceManageWorker.java:278)
at ru.bitel.bgbilling.modules.tv.access.manage.DeviceManageWorker.doTask(DeviceManageWorker.java:212)
... 16 more
connection 08-03/10:13:49 INFO [sa-p-7-t-28] DeviceManageWorker - Execution error - waiting 5000ms for next try.
Скорее всего, нужно еще авторизоваться, так, как это делается в шедулере, когда он синхронизирует терминалы:
Цитата:
08-03/09:53:15 INFO [pool-1-thread-2] JsonClient - post:
https://***.iptvportal.ru:443/api/jsonrpc/08-03/09:53:15 INFO [pool-1-thread-2] JsonClient - >> {"method":"authorize_user","id":1,"jsonrpc":"2.0","params":{"password":"***","username":"***"}}
08-03/09:53:16 INFO [pool-1-thread-2] JsonClient - << {"jsonrpc":"2.0","id":1,"result":{"id":1,"session_id":"4080a66cba65426cae460c09590a19c2","language_iso639_1":"ru"}}
08-03/09:53:16 INFO [pool-1-thread-2] JsonClient - post:
https://***.iptvportal.ru:443/api/jsonsql/08-03/09:53:16 INFO [pool-1-thread-2] JsonClient - {Iptvportal-Authorization=sessionid=4080a66cba65426cae460c09590a19c2}
08-03/09:53:16 INFO [pool-1-thread-2] JsonClient - >> {"method":"select","id":2,"jsonrpc":"2.0","params":{"data":["id","mac_addr","inet_addr","disabled"],"from":"terminal","where":{"eq":["subscriber_id","1415892"]}}}
08-03/09:53:17 INFO [pool-1-thread-2] JsonClient - << {"result":[[1930231,"00:53:45:00:00:00","31.129.22.203",null]],"id":2,"method":"select"}
08-03/09:53:17 INFO [pool-1-thread-2] IptvPortalTerminalSynchronizingTask - Found new terminal in MW
08-03/09:53:17 INFO [pool-1-thread-2] IptvPortalTerminalSynchronizingTask - Терминал:005345000000
08-03/09:53:17 INFO [pool-1-thread-2] IptvPortalTerminalSynchronizingTask - Link terminal:1930231 with tvAccount:8
08-03/09:53:17 INFO [pool-1-thread-2] JsonClient - post:
https://***.iptvportal.ru:443/api/jsonsql/08-03/09:53:17 INFO [pool-1-thread-2] JsonClient - {Iptvportal-Authorization=sessionid=4080a66cba65426cae460c09590a19c2}
08-03/09:53:17 INFO [pool-1-thread-2] JsonClient - >> {"method":"select","id":3,"jsonrpc":"2.0","params":{"data":["id","mac_addr","inet_addr","disabled"],"from":"terminal","where":{"eq":["subscriber_id","1416440"]}}}
...
Тут еще нужно учесть, если дело именно в авторизации, что ее настройки для iptvportal'а работают только если они занесены в поля в редакторе устройства - "Хост/порт", "Логин", "Пароль". Если прописывать их в поле "Конфигурация", в опции om.login, om.password, om.url, то авторизация не работает, ошибка пишется такая (например, при заведении аккаунта):
Цитата:
connection 08-03/10:24:06 INFO [sa-p-7-t-31] OrderManagerSet - Connecting to device
connection 08-03/10:24:06 INFO [sa-p-7-t-31] JsonClient - post:
https://***.iptvportal.ru:443/api/jsonrpcconnection 08-03/10:24:06 INFO [sa-p-7-t-31] JsonClient - >> {"method":"authorize_user","id":6,"jsonrpc":"2.0","params":{"password":"***","username":"***"}}
connection 08-03/10:24:07 INFO [sa-p-7-t-31] JsonClient - Response code = 500
connection 08-03/10:24:07 INFO [sa-p-7-t-31] JsonClient - << <h1>Server Error (500)</h1>
connection 08-03/10:24:07 ERROR [sa-p-7-t-31] OrderManagerDeviceWorker - ru.bitel.bgbilling.modules.tv.dyn.JsonClient$JsonClientException: Ошибка при получении ответа (500)
ru.bitel.bgbilling.common.BGException: ru.bitel.bgbilling.modules.tv.dyn.JsonClient$JsonClientException: Ошибка при получении ответа (500)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerSet.connect(OrderManagerSet.java:172)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerDeviceWorker.runWorker(OrderManagerDeviceWorker.java:188)
at ru.bitel.bgbilling.kernel.event.EventWorker.internalRunWorker(EventWorker.java:139)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerDeviceWorker.runImpl(OrderManagerDeviceWorker.java:111)
at ru.bitel.common.worker.WorkerTask.run(WorkerTask.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ru.bitel.common.worker.WorkerThread.run(WorkerThread.java:46)
Caused by: ru.bitel.bgbilling.modules.tv.dyn.JsonClient$JsonClientException: Ошибка при получении ответа (500)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.requestImpl0(JsonClient.java:233)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.requestImpl(JsonClient.java:242)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.invoke(JsonClient.java:320)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalJsonClient.invoke(IptvPortalJsonClient.java:102)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalJsonClient.authorize(IptvPortalJsonClient.java:112)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalOrderManager.connect(IptvPortalOrderManager.java:177)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerSet.connect(OrderManagerSet.java:165)
... 12 more
connection 08-03/10:24:07 INFO [sa-p-7-t-31] OrderManagerSet - Disconnecting from device
connection 08-03/10:24:07 ERROR [sa-p-7-t-31] EventWorker - class ru.bitel.bgbilling.modules.tv.access.om.OrderManagerDeviceWorker: ru.bitel.bgbilling.modules.tv.dyn.JsonClient$JsonClientException: Ошибка при получении ответа (500)
ru.bitel.bgbilling.common.BGException: ru.bitel.bgbilling.modules.tv.dyn.JsonClient$JsonClientException: Ошибка при получении ответа (500)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerSet.connect(OrderManagerSet.java:172)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerDeviceWorker.runWorker(OrderManagerDeviceWorker.java:188)
at ru.bitel.bgbilling.kernel.event.EventWorker.internalRunWorker(EventWorker.java:139)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerDeviceWorker.runImpl(OrderManagerDeviceWorker.java:111)
at ru.bitel.common.worker.WorkerTask.run(WorkerTask.java:86)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at ru.bitel.common.worker.WorkerThread.run(WorkerThread.java:46)
Caused by: ru.bitel.bgbilling.modules.tv.dyn.JsonClient$JsonClientException: Ошибка при получении ответа (500)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.requestImpl0(JsonClient.java:233)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.requestImpl(JsonClient.java:242)
at ru.bitel.bgbilling.modules.tv.dyn.JsonClient.invoke(JsonClient.java:320)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalJsonClient.invoke(IptvPortalJsonClient.java:102)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalJsonClient.authorize(IptvPortalJsonClient.java:112)
at ru.bitel.bgbilling.modules.tv.dyn.ares.iptvportal.IptvPortalOrderManager.connect(IptvPortalOrderManager.java:177)
at ru.bitel.bgbilling.modules.tv.access.om.OrderManagerSet.connect(OrderManagerSet.java:165)
... 12 more
connection 08-03/10:24:07 INFO [sa-p-7-t-31] OrderManagerDeviceWorker - Execution error (0) - waiting 60000ms for next try.
mq 08-03/10:24:35 INFO [event-proc-p-2-t-1] TvAccountRuntimeMap - Caught event: Event[ru.bitel.bgbilling.modules.tv.api.common.event.TvAccountModifiedEvent] moduleId: 10; pluginId: no; cid: 3598; scid: -1; userId: 1; timestamp: 1470187475395
mq 08-03/10:24:35 INFO [event-proc-p-2-t-1] TvAccountRuntimeMap - Adding new accountRuntime: 12
mq 08-03/10:24:35 INFO [event-proc-p-2-t-1] TvAccountRuntimeMap - Loading TvAccount from database.
mq 08-03/10:24:35 INFO [event-proc-p-2-t-1] TvAccountRuntimeMap - Adding TvAccountRuntime: 12
mq 08-03/10:24:35 INFO [event-proc-p-2-t-1] TvAccountRuntimeMap - ContractId: 3598; tvAccountId: 12
Аккаунт:112
Products [] TariffModuleTreeSet []
Device state: 0; serviceIds:
То есть параметры авторизации надо брать из полей "Хост/порт", "Логин", "Пароль".