AutoGRAPH.NET Service (EN) — различия между версиями

Материал из TK
Перейти к: навигация, поиск
(Download links)
 
(не показано 8 промежуточных версий 2 участников)
Строка 1: Строка 1:
AutoGRAPH.NET Service provide different protocols for integration with external systems. Currently we have two protocols for this: WCF (Windows communication foundation) and JSON for accessing to [[AutoGRAPH.NET]] core. Schemas configuration can be changed by AutoGRAPH.NET software. AutoGRAPH.NET Service can be run in two modes: as console application and as system service.
+
AutoGRAPH.NET Service provides different protocols for integration with external systems. Currently we have two protocols for this one: WCF (Windows communication foundation) and JSON for accessing to [[AutoGRAPH.NET]] core. Schemas configuration can be changed by AutoGRAPH.NET software. AutoGRAPH.NET Service can be run in two modes: as a console application and as a system service.
  +
  +
[[Файл:AGNetService en.png]]
   
 
== Minimal requirements for hardware and software environment ==
 
== Minimal requirements for hardware and software environment ==
   
*RAM – from 1 GB
+
*RAM – 2 GB or large
*Windows 2003 or latest
+
*Windows 2008 or latest
*.NET Framework 4.0 or latest
+
*.NET Framework 4.5 or latest
 
*Installed ([[AGDataLoader|AutoGRAPH DataLoader]]) or [[AutoGRAPH Server 5|AutoGRAPH Server 3.x or 4.x or 5.x]]
 
*Installed ([[AGDataLoader|AutoGRAPH DataLoader]]) or [[AutoGRAPH Server 5|AutoGRAPH Server 3.x or 4.x or 5.x]]
   
 
== Download links ==
 
== Download links ==
   
Last version: 2015.7.18.1, [[Media:AutoGRAPHNETService20150718 1.zip|Download]]
+
Last version: 2016.10.19, http://agi.tk-chel.ru/install/service/AutoGRAPHService20161019.zip
  +
  +
Examples: http://agi.tk-chel.ru/install/service/AutoGRAPHServiceExamples.zip
  +
  +
Access to our demo service: http://m.tk-chel.ru port 8100 (WCF) or 8300 (JSON), login '''service-example''' password '''12345678'''
  +
  +
Load demo configuration DemoCEBIT into AutoGRAPH.Pro: host m.tk-chel.ru port 2230, login '''demo''' password '''demo'''
   
 
== Console mode ==
 
== Console mode ==
   
This mode designed for debugging and testing. Simply run '''AutoGRAPHNETService.exe''' in console.
+
This mode is designed for debugging and testing. Simply run '''AutoGRAPHNETService.exe''' in console.
   
 
== Service mode ==
 
== Service mode ==
   
Installed as system Windows service and working autonomous. Command line for installing:
+
The service is installed as system Windows service and working autonomous. Command line for the installation:
   
 
<pre>
 
<pre>
Строка 26: Строка 34:
 
<span class="marker">&nbsp;Don't forget space between binPath= and full path &nbsp;</span>
 
<span class="marker">&nbsp;Don't forget space between binPath= and full path &nbsp;</span>
   
== Configuring ==
+
== Working with service ==
 
1. Extracting archive with AutoGRAPH.NET Service in some directory 2. Open '''AutoGRAPHNETService.exe.config''' in Notepad. You can see next keys in .config file:
 
 
<pre>
 
<add key="key-file" value="N:\AGServer\AutoGRAPHServer_3.0\30008_4x4_magnitka.agkey"/>
 
<add key="address" value="http://localhost:800/"/>
 
<add key="address-json" value="http://localhost:810/"/>
 
<add key="common-directory" value="C:\ProgramData\AutoGRAPH Shell"/>
 
<add key="data-directory" value="C:\Users\denisio\AppData\Roaming\AutoGRAPH Shell\Data"/>
 
</pre>
 
 
{| border="1" cellspacing="0" cellpadding="5" style="width: 100%;"
 
|-
 
| style="width: 127px;" | key-file
 
| style="width: 1145px;" | .agkey licensing file (from AutoGRAPH.Server), this file contain allowed devices.<br/><span class="marker"><span style="background-color:#FFFF00;">Required parameter!</span></span><br/>
 
|-
 
| style="width: 127px;" | address
 
| style="width: 1145px;" | local address end point for working with [https://msdn.microsoft.com/en-us/library/dd699756(v=vs.110).aspx WCF] (<span style="line-height: 20.7999992370605px;">protocol (httpBinding mode)</span>. Uri can be set in url:port format<br/>Also, you can use next variations:
 
*'''<tt>[http://192.168.1.3:8000 http://192.168.1.3:8000]</tt>''' - accept connections on local IP-address 192.168.1.3 and TCP-port 8000 (usually this mode used with several network cards)
 
*'''<tt>[http://0.0.0.0:8000 http://0.0.0.0:8000]</tt>''' or '''<tt><code>[http://*:8000&nbsp http://*:8000]&nbsp;</code></tt>'''- <span style="line-height: 20.7999992370605px;">accept connections &nbsp;</span>on all enabled network interfaces and IP-addressed and TCP-port 8000
 
*'''<tt>[http://127.0.0.1:8000 http://127.0.0.1:8000]</tt>''' - accept connections only locally (usually used with local installed software)
 
 
|-
 
| style="width: 127px;" | address-json
 
| style="width: 1145px;" | <span style="line-height: 20.7999992370605px;">локальный адрес, на котором обрабатываются запросы по протоколу [https://en.wikipedia.org/wiki/JSON JSON]</span><span style="line-height: 20.7999992370605px;">. Формат - url:port</span><br/><span style="line-height: 20.7999992370605px;">Варианты использования:</span><ul style="line-height: 20.7999992370605px;">
 
<li>'''<tt>[http://192.168.1.3:8000 http://192.168.1.3:8000]</tt>'''&nbsp;- принимать подключения на локальном IP-адресе 192.168.1.3 и TCP-порт 8000 (обычно данный вариант используется, если в сервере установлено несколько сетевых карт или задано несколько IP-адресов)</li>
 
<li>'''<tt>[http://0.0.0.0:8000 http://0.0.0.0:8000]</tt>'''&nbsp;или&nbsp;'''<tt>[http://*:8000&nbsp http://*:8000]&nbsp;</tt>'''-&nbsp;<span style="line-height: 20.7999992370605px;">принимать подключения&nbsp;</span>на всех доступных локальных IP-адресах и TCP-порту 8000</li>
 
<li>'''<tt>[http://127.0.0.1:8000 http://127.0.0.1:8000]</tt>'''&nbsp;- принимать подключения только локально&nbsp;(обычно используется, когда приложение, которое работает со службой, установлено на том же компьютере, что и служба. При этом запросы, идущие через сетевые карты - будут игнорироваться в целях безопасности.&nbsp;Типичный пример - установка службы на сервере 1С:Предприятия.)</li>
 
</ul>
 
 
|-
 
| style="width: 127px;" | common-directory<br/>
 
| style="width: 1145px;" | directory with common data files (directory structure same with directory of [[AutoGRAPH.NET]] software – with Schemes, GeoFences, Devices subdirectories with files)<br/>
 
|-
 
| style="width: 127px;" | data-directory<br/>
 
| style="width: 1145px;" | devices data directory [[AGDataLoader|AutoGRAPH DataLoader]] or [[AutoGRAPH Server 5|AutoGRAPH Server 3.x or 4.x or 5.x]]<br/>
 
|}
 
 
Save .config file after editing and run service or run in command line. Run next command line for generate .cs file with proxy-class:<br/><pre>
 
svcutil.exe http://localhost:800/?wsdl /async /tcv:Version35 /ser:DataContractSerializer
 
</pre><br/>AutoGRAPHSvc.cs and output.config file will created in current directory. This file configured for use WCF-endpoint of AutGRAPH.NET Service.
 
 
== Service methods ==
 
 
*[[AutoGRAPH.NET Service EnumSchemas (EN)|EnumSchemas]] – enumerate allowed schemas
 
*[[AutoGRAPH.NET Service EnumDevices (EN)|EnumDevices]] – enumerate devices in schema
 
*[[AutoGRAPH.NET Service EnumDrivers (EN)|EnumDrivers]] – enumerate drivers in schema
 
*[[AutoGRAPH.NET Service EnumGeoFences (EN)|EnumGeoFences]] – enumerate geofences in schema
 
*[[AutoGRAPH.NET Service GetGeoFences (EN)|GetGeoFences]] – get information about geofences (points, polygons, etc)
 
*[[AutoGRAPH.NET Service GetDevicesInfo (EN)|GetDevicesInfo]] – get information about devices in schema
 
*[[AutoGRAPH.NET Service EnumParameters (EN)|EnumParameters]] – get schema parameters
 
*[[AutoGRAPH.NET Service GetOnlineInfo (EN)|GetOnlineInfo]] – get device(s) last position and last date/time information
 
*[[AutoGRAPH.NET Service GetOnlineInfoAll (EN)|GetOnlineInfoAll]] - get device(s) last position and last date/time information (for ALL devices in schema)
 
*''GetDataRanges – get allowed data files from devices''
 
*[[AutoGRAPH.NET Service GetTrips (EN)|GetTrips]] – get trips information for specified device(s)
 
*[[AutoGRAPH.NET Service GetTripsCustom (EN)|GetTripsCustom]] [[File:Tag-new.png]] – get trips information with custom geofences
 
*[[AutoGRAPH.NET Service GetStage (EN)|GetStage]] [[File:Tag-new.png]] – get single stage information of specified device(s)
 
*[[AutoGRAPH.NET Service GetTrack (EN)|GetTrack]] – get track information (date/time/coordinates/speed/...) of specified device(s)
 
*[[AutoGRAPH.NET Service GetProperties (EN)|GetProperties]] – get property and values list of specified device(s)
 
*[[AutoGRAPH.NET Service GetProperty (EN)|GetProperty]] – get single property value of specified device(s)
 
*[[AutoGRAPH.NET Service GetRoute (EN)|GetRoute]] – calculate route between specified points
 
*[[AutoGRAPH.NET Service WaitData (EN)|WaitData]] [[File:Tag-new.png]] - wait for new device data
 
*[[AutoGRAPH.NET Service EnumReports (EN)|EnumReports]] [[File:Tag-new.png]] - get allowed reports
 
*[[AutoGRAPH.NET Service GetReports (EN)|GetReports]] [[File:Tag-new.png]] - run reports and download in XML/PDF/DOCX/XLS/.../ZIP-file
 
*[[AutoGRAPH.NET Service ExecuteReports (EN)|ExecuteReports]] [[File:Tag-new.png]] - run report asynchronously
 
*[[AutoGRAPH.NET Service GetReportsStatus (EN)|GetReportsStatus]] [[File:Tag-new.png]] - get report executing status (for asynchronous executing)
 
*''CancelReports - cancel report creating''
 
 
== Examples ==
 
 
<code><syntaxhighlight lang="csharp">
 
using System;
 
using System.Collections.Generic;
 
using System.Globalization;
 
using System.Linq;
 
using System.Text;
 
using AutoGRAPHService;
 
 
namespace AutoGRAPHSvcTest
 
{
 
class Program
 
{
 
static void Main(string[] args)
 
{
 
var svc = new AutoGRAPHSvcClient(); // make proxy class with default end points
 
 
RSchema[] schemas;
 
using (var f = new TimeCalc("EnumSchemas")) // get schemas list
 
schemas = svc.EnumSchemas();
 
 
REnumDevices devices;
 
using (var f = new TimeCalc("EnumDevices"))
 
devices = svc.EnumDevices(schemas[0].Name); // get device list for first allowed schema
 
foreach (var item in devices.Items)
 
Console.WriteLine("\t" + item.Name);
 
 
using (var f = new TimeCalc("EnumGeoFences")) // get geofences list
 
svc.EnumGeoFences(schemas[0].Name);
 
using (var f = new TimeCalc("GetDevicesInfo"))
 
svc.GetDevicesInfo(schemas[0].Name);
 
 
using (var f = new TimeCalc("EnumParameters")) // get parameter list for all devices in schema
 
svc.EnumParameters(schemas[0].Name, devices.Items.Select(p => p.ID).ToArray());
 
 
using (var f = new TimeCalc("GetOnlineInfo")) // get online status of devices
 
svc.GetOnlineInfo(schemas[0].Name, devices.Items.Select(p => p.ID).ToArray());
 
 
using (var f = new TimeCalc("GetTrips")) // get trips list for last 5 days of all devices with numbers more than 9999998
 
svc.GetTrips(schemas[0].Name,
 
devices.Items.Where(p => p.Serial >= 9999998).Select(p => p.ID).ToArray(),
 
DateTime.Now.AddDays(-5), DateTime.Now);
 
 
using (var f = new TimeCalc("GetTrack")) // get tracks for last 5 days of all devices with numbers more than 9999998
 
{
 
var t1 = svc.GetTrack(schemas[0].Name,
 
devices.Items.Where(p => p.Serial >= 9999998).Select(p => p.ID).ToArray(),
 
DateTime.Now.AddDays(-5), DateTime.Now);
 
}
 
 
Console.ReadLine();
 
}
 
}
 
   
  +
===[[AutoGRAPH.NET_Service_Config_en|Configuration]]===
// simple class for calculating running time
 
class TimeCalc:IDisposable
 
{
 
readonly DateTime DT;
 
readonly string name;
 
internal TimeCalc(string name) { DT = DateTime.Now; this.name = name; }
 
void IDisposable.Dispose() { Console.WriteLine(name+": "+DateTime.Now.Subtract(DT).TotalSeconds.ToString("F3", CultureInfo.InvariantCulture)); }
 
}
 
}
 
</syntaxhighlight></code>
 
   
  +
==='''[[AutoGRAPH.NET_Service_Methods_en|Service methods]]'''===
<u>.exe.config of this example</u><br/><syntaxhighlight lang="xml">
 
<?xml version="1.0" encoding="utf-8" ?>
 
<configuration>
 
<system.serviceModel>
 
<bindings>
 
<basicHttpBinding>
 
<binding name="BasicHttpBinding_IAutoGRAPHSvc"
 
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
 
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
 
maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
 
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
 
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16348"
 
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
 
<security mode="None">
 
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
 
<message clientCredentialType="UserName" algorithmSuite="Default" />
 
</security>
 
</binding>
 
</basicHttpBinding>
 
</bindings>
 
<client>
 
<endpoint address="http://localhost:800/" binding="basicHttpBinding"
 
bindingConfiguration="BasicHttpBinding_IAutoGRAPHSvc" contract="IAutoGRAPHSvc"
 
name="BasicHttpBinding_IAutoGRAPHSvc" />
 
</client>
 
</system.serviceModel>
 
</configuration>
 
</syntaxhighlight>
 
   
== [[AutoGRAPH.NET Service troubleshooting|Troubleshooting]] ==
+
===[[AutoGRAPH.NET_Service_Examples_en|Examples]]===
   
  +
===[[AutoGRAPH.NET_Service_Diagnostics|Troubleshooting]]===
[[AutoGRAPH.NET Service Диагностика неисправностей|здесь]].
 

Текущая версия на 09:18, 20 октября 2016

AutoGRAPH.NET Service provides different protocols for integration with external systems. Currently we have two protocols for this one: WCF (Windows communication foundation) and JSON for accessing to AutoGRAPH.NET core. Schemas configuration can be changed by AutoGRAPH.NET software. AutoGRAPH.NET Service can be run in two modes: as a console application and as a system service.

AGNetService en.png

Minimal requirements for hardware and software environment

Download links

Last version: 2016.10.19, http://agi.tk-chel.ru/install/service/AutoGRAPHService20161019.zip

Examples: http://agi.tk-chel.ru/install/service/AutoGRAPHServiceExamples.zip

Access to our demo service: http://m.tk-chel.ru port 8100 (WCF) or 8300 (JSON), login service-example password 12345678

Load demo configuration DemoCEBIT into AutoGRAPH.Pro: host m.tk-chel.ru port 2230, login demo password demo

Console mode

This mode is designed for debugging and testing. Simply run AutoGRAPHNETService.exe in console.

Service mode

The service is installed as system Windows service and working autonomous. Command line for the installation:

sc create AutoGRAPHNETService binPath= "C:\TK\WebMapK\Build-Svc\AutoGRAPHNETService.exe"

 Don't forget space between binPath= and full path  

Working with service

Configuration

Service methods

Examples

Troubleshooting