private void SendOneWay(object request, MessageHeader operationType) { MessageVersion messageVersion = _channelFactory.Endpoint.Binding.MessageVersion; Message message = CreateOneWayMessage(request, operationType, messageVersion); ISoapService service = _channelFactory.CreateChannel(); using (var channel = service as IClientChannel) { try { service.ProcessOneWay(message); } finally { if (channel.State == CommunicationState.Faulted) { channel.Abort(); } else { channel.Close(); } } } }
private TResponse Send <TResponse>(object request, MessageHeader operationType) { MessageVersion messageVersion = _channelFactory.Endpoint.Binding.MessageVersion; Message message = CreateMessage(request, operationType, messageVersion); ISoapService service = _channelFactory.CreateChannel(); using (var channel = service as IClientChannel) { try { Message result = service.Process(message); return(result.GetBody <TResponse>()); } finally { if (channel.State == CommunicationState.Faulted) { channel.Abort(); } else { channel.Close(); } } } }
static void Main(string[] args) { ServiceHost restHost = new ServiceHost(typeof(RestService), new Uri(RestServiceAddress)); ServiceEndpoint restSep = restHost.AddServiceEndpoint(typeof(IRestService), new WebHttpBinding(), ""); restSep.EndpointBehaviors.Add(new WebHttpBehavior { HelpEnabled = true }); restHost.Open(); ServiceHost soapHost = new ServiceHost(typeof(SoapService), new Uri(SoapServiceAddress)); ServiceEndpoint soapSep = soapHost.AddServiceEndpoint(typeof(ISoapService), new BasicHttpBinding(), ""); ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15; soapHost.Description.Behaviors.Add(smb); soapHost.Open(); Console.WriteLine("hosts opened"); ChannelFactory <ISoapService> factory = new ChannelFactory <ISoapService>(new BasicHttpBinding(), new EndpointAddress(SoapServiceAddress)); ISoapService proxy = factory.CreateChannel(); Console.WriteLine(proxy.CallAdd(1, 2)); Console.WriteLine(proxy.CallEcho("hello word")); Console.ReadLine(); }
private void SendOneWay(object request, MessageHeader operationType) { MessageVersion messageVersion = _channelFactory.Endpoint.Binding.MessageVersion; Message message = CreateOneWayMessage(request, operationType, messageVersion); ISoapService channel = _channelFactory.CreateChannel(); channel.ProcessOneWay(message); }
private TResponse Send <TResponse>(object request, MessageHeader operationType) { MessageVersion messageVersion = _channelFactory.Endpoint.Binding.MessageVersion; Message message = CreateMessage(request, operationType, messageVersion); ISoapService channel = _channelFactory.CreateChannel(); Message result = channel.Process(message); return(result.GetBody <TResponse>()); }
private void SendOneWay(object request, MessageHeader operationType) { using (var factory = new ChannelFactory <ISoapService>(_endpointConfigurationName)) { MessageVersion messageVersion = factory.Endpoint.Binding.MessageVersion; Message message = CreateOneWayMessage(request, operationType, messageVersion); ISoapService channel = factory.CreateChannel(); channel.ProcessOneWay(message); } }
private TResponse ProcessWithResponse <TResponse>(object request, MessageHeader operationType) { using (var factory = new ChannelFactory <ISoapService>(_endpointConfigurationName)) { MessageVersion messageVersion = factory.Endpoint.Binding.MessageVersion; Message message = CreateMessageWithResponse(request, operationType, messageVersion); ISoapService channel = factory.CreateChannel(); Message result = channel.ProcessWithResponse(message); return(result.GetBody <TResponse>()); } }
public void HandleRequest(IDictionary<string, object> environment, ISoapService soapService) { //TODO: exception handling var requestStream = environment["owin.RequestBody"] as Stream; var headers = environment["owin.RequestHeaders"] as IDictionary<string, string[]>; var serviceName = soapService.ParseWebServiceClassName(headers); var request = soapService.ParseSoapRequest(requestStream, serviceName, supportedServiceInfos); var returnValue = soapService.Invoke(request); var serialize = soapService.CreateResponseBody(returnValue, request.WebService); var memoryStream = new MemoryStream(); using(StreamWriter writer = new StreamWriter(memoryStream)) { writer.Write(serialize); memoryStream.CopyTo((Stream)environment["owin.ResponseBody"]); } }
public Task <List <Message> > PaerserEmailAsync(Setting setting, ISoapService soapService) { List <Message> messages = new List <Message>(); using (var client = new ImapClient()) { client.Connect(setting.ImapServer, setting.ImapPort, SecureSocketOptions.SslOnConnect); client.Authenticate(setting.InputMail, setting.InputMailPassword); client.Inbox.Open(FolderAccess.ReadWrite); var uids = client.Inbox.Search(SearchQuery.New); uids = client.Inbox.Search(SearchQuery.NotSeen); foreach (var uid in uids) { var message = client.Inbox.GetMessage(uid); if (message.Subject == setting.Subject) { var ItemRegex = new Regex(setting.RegexMask, RegexOptions.Compiled); var AllParamList = ItemRegex.Matches(message.TextBody) .Cast <Match>() .Select(m => new { Name = m.Groups[1].ToString(), Value = m.Groups[2].ToString() }) .ToList(); var paramList = AllParamList.Join(setting.ParamSettings, ap => ap.Name, cp => cp.FullName, (paramsetting, parammessage) => new ParamMessage { Name = parammessage.Name, Value = paramsetting.Value }).ToList(); var resultService = soapService.SendRequest(setting, paramList); if (resultService == "sucsess") { client.Inbox.AddFlags(uid, MessageFlags.Seen, true); } } } client.Disconnect(true); } return(Task.Run(() => messages));; }
public AirShoppingService( ILogger <AirShoppingService> logger, IXmlService xmlService, ISoapService soapService, IDocumentFactory documentFactory, IPartyBuilder partyBuilder, ITravelerBuilder travelerBuilder, ICoreQueryBuilder coreQueryBuilder, IPreferenceBuilder preferenceBuilder) { _logger = logger; _xmlService = xmlService; _soapService = soapService; _documentFactory = documentFactory; _partyBuilder = partyBuilder; _travelerBuilder = travelerBuilder; _coreQueryBuilder = coreQueryBuilder; _preferenceBuilder = preferenceBuilder; }
public App(ISoapService service, OpenCVforms serviceOpencv, SmsBack sms) { App.service = service; App.serviceOpencv = serviceOpencv; App.sms = sms; InitializeComponent(); //Application.Current.Resources= new DarkTheme(); if (!System.IO.File.Exists(downloader.getFolder("tiles/world.mbtiles"))) { OSM.mbpath = downloader.DownloadFile("https://github.com/Mapsui/Mapsui/raw/master/Samples/Mapsui.Samples.Common/MbTiles/world.mbtiles", "tiles"); //OSM.mbpath = downloader.getFolder("tiles/torrejon-de-ardoz.mbtiles"); } OSM.mbpath = downloader.getFolder("tiles/world.mbtiles"); if (!System.IO.File.Exists(downloader.getFolder("tiles/torrejon-de-ardoz.mbtiles"))) { OSM.mbpath2 = downloader.DownloadFile("https://github.com/Mapsui/Mapsui/raw/master/Samples/Mapsui.Samples.Common/MbTiles/torrejon-de-ardoz.mbtiles", "tiles"); } //OSM.mbpath = downloader.getFolder("tiles/torrejon-de-ardoz.mbtiles"); OSM.mbpath2 = downloader.getFolder("tiles/torrejon-de-ardoz.mbtiles"); MainPage = new MasterPage(); }
public ToDoItemManager(ISoapService service) { soapService = service; }
public void PaerserEmailAsync(Setting setting, ISoapService soapService) { List <Message> messages = new List <Message>(); using (var client = new ImapClient()) { client.Connect(setting.ImapServer, setting.ImapPort, SecureSocketOptions.Auto); client.Authenticate(setting.InputMail, setting.InputMailPassword); client.Inbox.Open(FolderAccess.ReadWrite); var uids = client.Inbox.Search(SearchQuery.New); uids = client.Inbox.Search(SearchQuery.NotSeen); foreach (var uid in uids) { var message = client.Inbox.GetMessage(uid); if (message.Subject == setting.Subject && !setting.SmptPort.HasValue && !string.IsNullOrWhiteSpace(setting.RegexMask)) { var ItemRegex = new Regex(setting.RegexMask, RegexOptions.Compiled); var AllParamList = ItemRegex.Matches(message.TextBody) .Cast <Match>() .Select(m => new { Name = m.Groups[1].ToString(), Value = m.Groups[2].ToString() }) .ToList(); var paramList = AllParamList.Join(setting.ParamSettings, ap => ap.Name, cp => cp.FullName, (paramsetting, parammessage) => new ParamMessage { Name = parammessage.Name, Value = paramsetting.Value }).ToList(); var resultService = soapService.SendRequest(setting, paramList, message.TextBody, message.Date.Date.ToString()); if (resultService == "OK") { client.Inbox.AddFlags(uid, MessageFlags.Seen, true); } } else if (message.Subject == setting.Subject && !setting.SmptPort.HasValue) { string[] lines = message.TextBody.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None); var paramList = (from line in lines join settParam in setting.ParamSettings on line.Split(new string[] { ": " }, StringSplitOptions.None).FirstOrDefault() equals settParam.FullName select new ParamMessage { Name = settParam.Name, Value = line.Split(new string[] { ": " }, StringSplitOptions.None).LastOrDefault() }).ToList(); var resultService = soapService.SendRequest(setting, paramList, message.TextBody, message.Date.Date.ToString()); if (resultService == "OK") { // client.Inbox.AddFlags(uid, MessageFlags.Seen, true); } } else if (message.Subject.Contains(setting.Subject) && setting.SmptPort.HasValue && this.SendEmailAsync(setting, setting.OutputMail, message.Subject, message.TextBody)) { client.Inbox.AddFlags(uid, MessageFlags.Seen, true, default(CancellationToken)); } } client.Disconnect(true); } // return Task.CurrentId; }
public DublinBusManager(ISoapService service) { soapService = service; }
/// <summary> /// Initializes a new instance of the <see cref="T:ColonyClient.DataManeger"/> class. /// </summary> /// <param name="service">Service.</param> public DataManeger(ISoapService service) { soapService = service; }
public UserManager(ISoapService service) { soapService = service; }
public SOAP_Request(ISoapService service) { ISoapService = service; }
public ServiceManager(ISoapService svc) { soapService = svc; }
//TODO:This will need removing. public void SetupSoap(string webServiceURL) { Settings.WebServiceURL = webServiceURL; soapService = DependencyService.Get <ISoapService>(); }
public TodoItemManager (ISoapService service) { soapService = service; }
public SoapsController(ISoapService soapService, IMemoryCache memoryCache) { _soapService = soapService; _memoryCache = memoryCache; }
public async void selfDestruct(object sender, EventArgs args) { if (!CrossConnectivity.Current.IsConnected) { await DisplayAlert("alerta", "por favor conecte-se na internet ", "ok"); return; } if (cep.Text.Contains("-") && cep.Text.Length < 9) { await DisplayAlert("alerta", "preencha corretamente o cep ", "ok"); return; } if (!cep.Text.Contains("-") && cep.Text.Length < 8) { await DisplayAlert("alerta", "preencha corretamente o cep ", "ok"); return; } if (comp.SelectedIndex == 0) { await DisplayAlert("alerta", "preencha o comprimento ", "ok"); return; } if (largura.SelectedIndex == 0) { await DisplayAlert("alerta", "preencha o largura ", "ok"); return; } if (altura.SelectedIndex == 0) { await DisplayAlert("alerta", "preencha o altura ", "ok"); return; } if (pesostr.SelectedIndex == 0) { await DisplayAlert("alerta", "preencha o peso ", "ok"); return; } string yORn; yORn = "N"; if (avisoRece.IsToggled) { yORn = "S"; } //string myinput = await InputBox(this.Navigation); ISoapService ws = App.service; // , 41106 Resultado c = ws.getPrecoprazo("", "", "40010", cep_origem, cep.Text, pesostr.Items.ElementAt(pesostr.SelectedIndex), 1, int.Parse(comp.Items.ElementAt(comp.SelectedIndex)), int.Parse(altura.Items.ElementAt(altura.SelectedIndex)), int.Parse(largura.Items.ElementAt(largura.SelectedIndex)), 0, "N", 19.5m, yORn); if (!string.IsNullOrEmpty(c.Servicos.ElementAt(0).MsgErro)) { await DisplayAlert("Sedex varejo", "Erro: " + c.Servicos.ElementAt(0).MsgErro, "ok"); } else { await DisplayAlert("Sedex varejo", "preço: " + c.Servicos.ElementAt(0).Valor + "\nprazo em dias:" + c.Servicos.ElementAt(0).PrazoEntrega, "ok"); } if (c.Servicos.Length > 1) { if (!string.IsNullOrEmpty(c.Servicos.ElementAt(1).MsgErro)) { await DisplayAlert("Sedex varejo", "Erro: " + c.Servicos.ElementAt(1).MsgErro, "ok"); } else { await DisplayAlert("PAC varejo", "preço: " + c.Servicos.ElementAt(1).Valor + "\nprazo em dias:" + c.Servicos.ElementAt(1).PrazoEntrega, "ok"); } } }
public ServiceManager(ISoapService service) { soapService = service; }