git_bsmd/nsw/Source/bsmd.dbh.ResponseService/ResponseService.svc.cs

66 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using log4net;
using bsmd.database;
namespace bsmd.dbh.ResponseService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
public class ResponseService : IResponseService
{
private ILog _log = LogManager.GetLogger("dbh ResponseService");
public void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, bsmd.dbh.response.RootType Type,
List<bsmd.dbh.response.RootReportingClassesFullReportingClass> ReportingClassesFull,
List<bsmd.dbh.response.RootReportingClassesPartialReportingClass> ReportingClassesPartial,
List<bsmd.dbh.response.RootReportingClassesErrorReportingClass> RootReportingClassesError,
List<bsmd.dbh.response.RootReportingClassesResettedReportingClass> ReportingClassesResetted,
List<bsmd.dbh.response.RootMessage> Messages)
{
if (Version != null)
_log.InfoFormat("Version: {0}", Version);
if (MessageId != null)
_log.InfoFormat("MessageId: {0}", MessageId);
if (!VisitId.IsNullOrEmpty())
_log.InfoFormat("Visit-Id: {0}", VisitId);
if (!TransitId.IsNullOrEmpty())
_log.InfoFormat("Transit-Id: {0}", TransitId);
if (Timestamp != null)
_log.InfoFormat("Timestamp: {0}", Timestamp);
if (SenderReference != null)
_log.InfoFormat("Sender-Reference: {0}", SenderReference);
_log.InfoFormat("Type: {0}", Type);
if (Messages != null)
{
foreach (bsmd.dbh.response.RootMessage rootMessage in Messages)
{
_log.InfoFormat("Message type {0}: {1}", rootMessage.Type, rootMessage.Text);
}
}
if (SenderReference.IsNullOrEmpty())
{
_log.ErrorFormat("No sender reference, cannot process message");
return;
}
_log.DebugFormat("processing {0}..", MessageId ?? "?");
Response.ProcessResponse(VisitId, TransitId, Timestamp, SenderReference, Type, Messages,
ReportingClassesFull, ReportingClassesPartial, RootReportingClassesError, ReportingClassesResetted,
Properties.Settings.Default.DBConnectionString);
}
}
}