Commit ea073798 by AlexNasyr

Merge branch 'master' of https://github.com/AlexNasyr/Adapters

parents 953893e3 097f0e2a
......@@ -7,6 +7,8 @@ using System.Threading.Tasks;
using System.Net;
using ActiveMQ.Artemis.Client.Transactions;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace DDO_Application.Controllers {
......@@ -39,6 +41,16 @@ namespace DDO_Application.Controllers {
[Route("[controller]/lifetime")]
public int GetLifetime() => _apiService.Counter;
[HttpGet]
[Route("[controller]/checkXml")]
public bool CheckXml() {
string xsd = System.IO.File.ReadAllText("xsd/ddo-application-init.xsd");
string xml = System.IO.File.ReadAllText("xsd/ddo-application-request.xml"); //correct xml
//string xml = System.IO.File.ReadAllText("xsd/ddo-application-request-wrong.xml"); //wrong xml
var errors = new List<ValidationResult>();
return XmlValidator.IsValid(xml, xsd, errors);
}
[HttpPost]
[Route("[controller]/sendmsg/{msg}")]
public async Task<IActionResult> SendMessage(string msg) {
......
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Xml;
using System.Xml.Schema;
namespace DDO_Application.Model {
public class XmlValidator {
public static bool IsValid(string xml, string xsd, List<ValidationResult> errors) {
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.Schemas.Add(null, XmlReader.Create(new StringReader(xsd)));
xmlReaderSettings.ValidationType = ValidationType.Schema;
XmlReader reader = XmlReader.Create(new StringReader(xml), xmlReaderSettings);
XmlDocument xmlDocument = new XmlDocument();
try {
xmlDocument.Load(reader);
}
catch (XmlSchemaValidationException ex) {
errors?.Add(new ValidationResult(ex.Message));
return false;
}
return true;
}
}
}
......@@ -24,6 +24,5 @@ namespace DDO_Application.Services {
public override async Task StopAsync(CancellationToken stoppingToken) {
await base.StopAsync(stoppingToken);
}
}
}
......@@ -9,6 +9,7 @@ using DDO_Application.Services;
using ActiveMQ.Artemis.Client.Extensions.DependencyInjection;
using ActiveMQ.Artemis.Client;
using ActiveMQ.Artemis.Client.Extensions.Hosting;
using System;
namespace DDO_Application {
public class Startup {
......@@ -27,7 +28,6 @@ namespace DDO_Application {
string queue2 = "CONTINGENT.APPLICATION_INC";
string queue3 = "CONTINGENT.MV.REQ";
string queue4 = "CONTINGENT.MV.RESP";
string GUID = "e6c77d95-54a7-4645-818b-16fd71322b6e";
services.AddControllers();
......@@ -35,15 +35,20 @@ namespace DDO_Application {
services.AddHostedService<ApiHostedService>();
services.AddSingleton<IApiService, ApiProcessingService>();
// turn enable ActiveMQ support in project
//services.AddActiveMq("ddoApp-cluster", new[] { Endpoint.Create(host: "172.17.100.121", port: 61616, "contingent", "RjQ66VWS") })
services.AddActiveMq("ddoApp-cluster", new[] { Endpoint.Create(host: "192.168.2.19", port: 5672, "guest", "guest") })
//services.AddActiveMq("ddoApp-cluster", new[] { ActiveMQ })
//.AddProducer<MessageProducer>(queue2, RoutingType.Anycast)
//.AddTypedConsumer<TestMessage, TestMessageCunsomer>(queue2, RoutingType.Anycast);
.AddProducer<MessageProducer>(msgQueues.Out, RoutingType.Multicast)
.AddTypedConsumer<TestMessage, TestMessageCunsomer>(msgQueues.In, RoutingType.Multicast);
services.AddActiveMqHostedService();
try {
//services.AddActiveMq("ddoApp-cluster", new[] { Endpoint.Create(host: "172.17.100.121", port: 61616, "contingent", "RjQ66VWS") })
//services.AddActiveMq("ddoApp-cluster", new[] { Endpoint.Create(host: "192.168.2.19", port: 5672, "guest", "guest") })
//services.AddActiveMq("ddoApp-cluster", new[] { Endpoint.Create(host: "192.168.2.22", port: 5672, "admin", "admin") })
services.AddActiveMq("ddoApp-cluster", new[] { ActiveMQ })
//.AddProducer<MessageProducer>(queue2, RoutingType.Anycast)
//.AddTypedConsumer<TestMessage, TestMessageCunsomer>(queue2, RoutingType.Anycast);
.AddProducer<MessageProducer>(msgQueues.Out, RoutingType.Multicast)
.AddTypedConsumer<TestMessage, TestMessageCunsomer>(msgQueues.In, RoutingType.Multicast);
services.AddActiveMqHostedService();
}
catch (Exception ex) {
}
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
......@@ -2,8 +2,8 @@
"ActiveMQ": {
"Host": "192.168.2.22",
"Port": 5672,
"User": "guest",
"Pass": "guest"
"User": "admin",
"Pass": "admin"
},
"TestQueues": {
"In": "TestMessage",
......
<?xml version="1.0" encoding="utf-8"?>
<ns:FormData oktmo="00000000000" xmlns:ns="http://epgu.gosuslugi.ru/concentrator/kindergarten/3.2.1">
<ns:ApplicationRequest>
<ns:orderId>12345678</ns:orderId>
<ns:ServicesType>-10002202019</ns:ServicesType>
<ns:OldFilingDate>2020-10-15T09:30:10+03:00</ns:FilingDate>
<ns:NewPersonInfo>
<ns:PersonSurname>Èâàíîâà</ns:PersonSurname>
<ns:PersonName>Åëåíà</ns:PersonName>
<ns:PersonMiddleName>Âèêòîðîâíà</ns:PersonMiddleName>
<ns:PersonPhone>+7(123)1234567</ns:PersonPhone>
<ns:PersonEmail>test@test.ru</ns:PersonEmail>
<ns:Parents>true</ns:Parents>
</ns:NewPersonInfo>
<ns:PersonIdentityDocInfo>
<ns:IdentityDocName code="1">Ïàñïîðò ãðàæäàíèíà ÐÔ</ns:IdentityDocName>
<ns:IdentityDocSeries>6004</ns:IdentityDocSeries>
<ns:IdentityDocNumber>586830</ns:IdentityDocNumber>
<ns:IdentityDocIssueDate>2007-09-10</ns:IdentityDocIssueDate>
<ns:IdentityDocIssueCode>000009</ns:IdentityDocIssueCode>
<ns:IdentityDocIssued>Îòäåëåíèåì ÓÔÌÑ Ðîññèè</ns:IdentityDocIssued>
</ns:PersonIdentityDocInfo>
<ns:ChildInfo>
<ns:ChildSurname>Èâàíîâ</ns:ChildSurname>
<ns:ChildName>Âàñèëèé</ns:ChildName>
<ns:ChildMiddleName>Àëåêñàíäðîâè÷</ns:ChildMiddleName>
<ns:ChildBirthDate>2016-02-02</ns:ChildBirthDate>
<ns:ChildBirthDocRF>
<ns:ChildBirthDocSeries>VII-ËÄ</ns:ChildBirthDocSeries>
<ns:ChildBirthDocNumber>132564</ns:ChildBirthDocNumber>
<ns:ChildBirthDocIssueDate>2016-02-02</ns:ChildBirthDocIssueDate>
<ns:ChildBirthDocActNumber>13245</ns:ChildBirthDocActNumber>
<ns:ChildBirthDocActDate>2016-02-02</ns:ChildBirthDocActDate>
<ns:ChildBirthDocIssued>ÇÀÃÑ ðàéîíà ¹5</ns:ChildBirthDocIssued>
</ns:ChildBirthDocRF>
</ns:ChildInfo>
<ns:Address>
<ns:FullAddress>121351, Ìîñêâà ã., Áîáðóéñêàÿ óë., 4 ä., 2 êîðï.</ns:FullAddress>
<ns:Index>121351</ns:Index>
<ns:Region code="0c5b2444-70a0-4932-980c57b4dc0d3f02b5">ã. Ìîñêâà</ns:Region>
<ns:Area code=""></ns:Area>
<ns:City code=""></ns:City>
<ns:CityArea code=""></ns:CityArea>
<ns:Place code=""></ns:Place>
<ns:Street code="585eec0b-314c-4309-a497-3fe09300e903">óë. Áîáðóéñêàÿ</ns:Street>
<ns:AdditionalArea code=""></ns:AdditionalArea>
<ns:AdditionalStreet code=""></ns:AdditionalStreet>
<ns:House code="5956b056-0d23-4f59-9c52-f561968bdda0">4</ns:House>
<ns:Building1>2</ns:Building1>
<ns:Building2></ns:Building2>
<ns:Apartment>23</ns:Apartment>
</ns:Address>
<ns:EntryParams>
<ns:EntryDate>2018-09-01</ns:EntryDate>
<ns:Language code="1">Ðóññêèé</ns:Language>
<ns:Schedule code="2">Êðàòêîâðåìåííûé ðåæèì ïðåáûâàíèÿ (äî 5 ÷àñîâ)</ns:Schedule>
<ns:AgreementOnFullDayGroup>true</ns:AgreementOnFullDayGroup>
</ns:EntryParams>
<ns:AdaptationProgram>
<ns:AdaptationGroup code="2">Êîìïåíñèðóþùàÿ</ns:AdaptationGroup>
<ns:AdaptationGroupType code="4">Äëÿ ñëàáîâèäÿùèõ äåòåé</ns:AdaptationGroupType>
<ns:AgreementOnGeneralGroup>true</ns:AgreementOnGeneralGroup>
<ns:AgreementOnCareGroup>true</ns:AgreementOnCareGroup>
</ns:AdaptationProgram>
<ns:MedicalReport>
<ns:DocName code="1">Çàêëþ÷åíèå</ns:DocName>
<ns:DocSeries>À1</ns:DocSeries>
<ns:DocNumber>1122</ns:DocNumber>
<ns:DocIssueDate>2018-09-01</ns:DocIssueDate>
<ns:DocIssued>Öåíòðàëüíàÿ ÏÌÏÌÊ</ns:DocIssued>
<ns:DocFile>
<ns:CodeDocument>MedicalFile</ns:CodeDocument>
<ns:NameDocument>Çàêëþ÷åíèå.pdf</ns:NameDocument>
<ns:TypeDocument>application/pdf</ns:TypeDocument>
</ns:DocFile>
<ns:DocFile>
<ns:CodeDocument>MedicalSignature</ns:CodeDocument>
<ns:NameDocument>Çàêëþ÷åíèå.pdf.sig</ns:NameDocument>
<ns:TypeDocument>application/x-pkcs7-signature</ns:TypeDocument>
</ns:DocFile>
</ns:MedicalReport>
<ns:EduOrganizations>
<ns:EduOrganization code="215" PriorityNumber="1">Âàñèë¸ê</ns:EduOrganization>
<ns:EduOrganization code="219" PriorityNumber="2">Ñîëíûøêî</ns:EduOrganization>
<ns:EduOrganization code="221" PriorityNumber="3">Ðîìàøêà</ns:EduOrganization>
<ns:AllowOfferOther>true</ns:AllowOfferOther>
</ns:EduOrganizations>
<ns:BrotherSisterInfo>
<ns:ChildSurname>Èâàíîâ</ns:ChildSurname>
<ns:ChildName>Ïåòð</ns:ChildName>
<ns:ChildMiddleName>Àëåêñàíäðîâè÷</ns:ChildMiddleName>
<ns:EduOrganization code="215">Âàñèë¸ê</ns:EduOrganization>
</ns:BrotherSisterInfo>
<ns:BenefitInfo>
<ns:BenefitCategory code="9"> Äåòè âîåííîñëóæàùèõ, ïðîõîäÿùèõ âîåííóþ ñëóæáó ïî êîíòðàêòó </ns:BenefitCategory>
<ns:BenefitDocInfo>
<ns:DocIssueDate>2018-03-02</ns:DocIssueDate>
<ns:DocIssued>Ñïðàâêà ñ ðàáîòû</ns:DocIssued>
</ns:BenefitDocInfo>
<ns:BenefitFile>
<ns:CodeDocument>BenefitFile</ns:CodeDocument>
<ns:NameDocument>Ñïðàâêà.pdf</ns:NameDocument>
<ns:TypeDocument>application/pdf</ns:TypeDocument>
</ns:BenefitFile>
<ns:BenefitFile>
<ns:CodeDocument>BenefitSignature</ns:CodeDocument>
<ns:NameDocument>Ñïðàâêà.pdf.sig</ns:NameDocument>
<ns:TypeDocument>application/x-pkcs7-signature</ns:TypeDocument>
</ns:BenefitFile>
</ns:BenefitInfo>
</ns:ApplicationRequest>
</ns:FormData>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment