public override void Delete(ref Soap.TransactionFramework.TransactionChain chain) { if (Facade != null) { AddNodeTransactionLink addNodeTransaction = Facade.TransactionOrigin as AddNodeTransactionLink; if (addNodeTransaction != null) { if (addNodeTransaction.TransactionStatus == ServerStatus.ProcessingClient) { DeleteNodeTransactionLink deleteTransaction = new DeleteNodeTransactionLink(); deleteTransaction.DomainId = DomainId; deleteTransaction.MapManager = MapManager; deleteTransaction.Node = Facade; chain.AddTransaction(deleteTransaction); return; } } } DelayedActions.Enqueue(new DelayedNodeAction() { Action = TransactionActionType.Deleted }); }
/// <inheritdoc /> public override void When() { Soap.Dispose(); Rest.Dispose(); GC.Collect(); }
public SignatureAnimator(ref TreeView tv, ref Soap securedSOAP) { useactSigItem = false; this.tv = tv; this.soap = securedSOAP; this.presentation = (SoapPresentation)securedSOAP.Presentation; dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); referencesTimer = new System.Windows.Threading.DispatcherTimer(); TransformsTimer = new System.Windows.Threading.DispatcherTimer(); referenceElementsTimer = new System.Windows.Threading.DispatcherTimer(); referenceElementsTimer.Tick += new EventHandler(referenceElementsTimer_Tick); referencesTimer.Tick += new EventHandler(referenceTimer_Tick); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); TransformsTimer.Tick += new EventHandler(TransformsTimer_Tick); elemBrush = new SolidColorBrush(Colors.MediumVioletRed); TextSizeAnimation = new DoubleAnimation(11, 16, TimeSpan.FromSeconds(1)); TextSizeAnimation.AutoReverse = false; TextSizeAnimationReverse = new DoubleAnimation(16, 11, TimeSpan.FromSeconds(1)); TextSizeAnimationReverse.AutoReverse = false; opacityAnimation = new DoubleAnimation(0.1, 1, TimeSpan.FromSeconds(1)); TextSizeAnimation1 = new DoubleAnimation(11, 16, TimeSpan.FromSeconds(1)); TextSizeAnimation1.AutoReverse = false; TextSizeAnimationReverse1 = new DoubleAnimation(16, 11, TimeSpan.FromSeconds(1)); TextSizeAnimationReverse1.AutoReverse = false; opacityAnimation1 = new DoubleAnimation(0.1, 1, TimeSpan.FromSeconds(1)); actTimer = dispatcherTimer; status = 0; animationRunning = false; signed = false; }
public void GetSoapById_ExpectingSoap_ResultShouldReturnSoapViewModel() { // arrange var mockSoapRepository = new Mock <ISoapRepository>(); var mockSoap = new Soap() { Id = Guid.NewGuid(), Brand = "Soap Brand 1", Edition = "Soap Edition 1", Description = "Soap Description 1", UnitPrice = 20, UnitQuantity = 100, URL = "img/soap1.jpeg" }; mockSoapRepository.Setup(x => x.GetById(It.IsAny <Guid>())).Returns(mockSoap); var config = new MapperConfiguration(cfg => { cfg.CreateMap <Soap, SoapViewModel>(); }); var mapper = config.CreateMapper(); // act var soapService = new SoapService(mockSoapRepository.Object, mapper); var result = soapService.GetSoapById(Guid.NewGuid()); // assert result.Should().BeOfType <SoapViewModel>(); }
public async Task <retConsSitNFe> ConsultarPelaChave(string chaveAcesso, string versao) { var chave = new ChaveFiscal(chaveAcesso); var consSit = new consSitNFe { chNFe = chaveAcesso, tpAmb = Configuracao.TipoAmbiente, versao = versao }; var xmlEvento = XmlUtils.ClasseParaXmlString <consSitNFe>(consSit); var arqEnv = Path.Combine("Logs", $"{DateTime.Now.Ticks}-pedConsSitNFe.xml"); await storage.SaveAsync(arqEnv, xmlEvento); var modeloDoc = chave.Modelo; var sefazUrl = Fabrica.FabricarUrl.ObterUrl(eTipoServico.ConsultaSituacaoNFe, Configuracao.TipoAmbiente, modeloDoc, Configuracao.UF); var envelope = Fabrica.SoapEnvelopeFabrica.FabricarEnvelope(eTipoServico.ConsultaSituacaoNFe, xmlEvento); var retornoXmlString = await Transmitir.TransmitirAsync(sefazUrl, envelope); var retornoXmlStringLimpa = Soap.LimparEnvelope(retornoXmlString, "retConsSitNFe").OuterXml; var arqRet = Path.Combine("Logs", $"{DateTime.Now.Ticks}-retConsSitNFe.xml"); await storage.SaveAsync(arqRet, retornoXmlStringLimpa); var retEnvEvento = new retConsSitNFe().CarregarDeXmlString(retornoXmlStringLimpa, xmlEvento); return(retEnvEvento); }
private async Task <string> PrepararTransmissao(distDFeInt distDFeInt, bool validarXmlConsulta = true) { var xml = XmlUtils.ClasseParaXmlString <distDFeInt>(distDFeInt); if (validarXmlConsulta) { Schemas.ValidarSchema(eTipoServico.NFeDistribuicaoDFe, xml, Configuracao); } var nomeArqEnv = $"{Configuracao.Emitente.CNPJ ?? Configuracao.Emitente.CPF}-{DateTime.Now.Ticks}-ped-DistDFeInt.xml"; var arqEnv = Path.Combine("Logs", nomeArqEnv); var stRet = await storage.SaveAsync(arqEnv, xml); var envelope = SoapEnvelopeFabrica.FabricarEnvelope(eTipoServico.NFeDistribuicaoDFe, xml); var sefazUrl = FabricarUrl.ObterUrl(eTipoServico.NFeDistribuicaoDFe, Configuracao.TipoAmbiente, eModeloDocumento.NFe, eUF.AN); var retorno = await Transmitir.TransmitirAsync(sefazUrl, envelope); var retornoLimpo = Soap.LimparEnvelope(retorno, "retDistDFeInt").OuterXml; var nomeArqRetorno = $"{Configuracao.Emitente.CNPJ ?? Configuracao.Emitente.CPF}-{DateTime.Now.Ticks}-retDistDFeInt.xml"; var arqRet = Path.Combine("Logs", nomeArqRetorno); await storage.SaveAsync(arqRet, retornoLimpo); return(retornoLimpo); }
public async Task <retEnvEvento> ManifestarAsync(ChaveFiscal chaveNFe, eTipoEventoNFe tipoEvento, string justificativa = null) { if (tipoEvento != eTipoEventoNFe.CienciaOperacao && tipoEvento != eTipoEventoNFe.ConfirmacaoOperacao && tipoEvento != eTipoEventoNFe.DesconhecimentoOperacao && tipoEvento != eTipoEventoNFe.OperacaoNaoRealizada) { throw new Exception("Evento não permitido nesse serviço"); } var xmlEvento = GerarXmlEvento(chaveNFe.Chave, tipoEvento, justificativa); var arqEnv = Path.Combine("Logs", Arquivo.MontarNomeArquivo("ped-eve.xml", config)); await storage.SaveAsync(arqEnv, xmlEvento); await storage.SaveAsync($"{DateTime.Now.Ticks}-ped-eve.xml", xmlEvento); Schemas.ValidarSchema(eTipoServico.ManifestacaoDestinatario, xmlEvento, config); var envelope = SoapEnvelopeFabrica.FabricarEnvelope(eTipoServico.ManifestacaoDestinatario, xmlEvento); var sefazUrl = FabricarUrl.ObterUrl(eTipoServico.ManifestacaoDestinatario, config.TipoAmbiente, eModeloDocumento.NFe, eUF.AN); var xmlRetorno = await transmitir.TransmitirAsync(sefazUrl, envelope); var xmlRetLimpo = Soap.LimparEnvelope(xmlRetorno, "retEnvEvento").OuterXml; var arqRet = Path.Combine("Logs", Arquivo.MontarNomeArquivo("ret-eve.xml", config)); await storage.SaveAsync(arqRet, xmlRetLimpo); var retEnvEvento = XmlUtils.XmlStringParaClasse <retEnvEvento>(xmlRetLimpo); return(retEnvEvento); }
public void SendToWS_SOAP(string url, string method, string service, string xml) { this.serviceContext.Services.SingleOrDefault(key => key.Key == service).Value.Should() .BeNull($"Сервис с названием '{service}' уже существует"); url.Should().NotBeEmpty("Ссылка на сервис не задана"); method.Should().NotBeEmpty("Метод сервиса не задан"); xml.Should().NotBeEmpty("Запрос к сервису не задан"); url = this.variableContext.ReplaceVariablesInXmlBody(url, (val) => System.Security.SecurityElement.Escape(Reflection.ConvertObject <string>(val))); method = this.variableContext.ReplaceVariablesInXmlBody(method, (val) => System.Security.SecurityElement.Escape(Reflection.ConvertObject <string>(val))); xml = this.variableContext.ReplaceVariablesInXmlBody(xml, (val) => System.Security.SecurityElement.Escape(Reflection.ConvertObject <string>(val))); this.consoleOutputHelper.WriteLine($"url (сериализован): {url}"); this.consoleOutputHelper.WriteLine($"Запрос (сериализован): {Environment.NewLine}{xml}"); using (var soap = new Soap(url, method)) { var(statusCode, errors) = soap.CallWebService(xml); this.serviceContext.Services.Add(service, new WebService() { Url = url, Body = xml, HeadersCollection = soap.Headers, ParametersCollection = null, Service = (Core.Data.Services.Service)soap.Clone(), StatusCode = statusCode, Errors = errors, }); } }
public async Task <retConsSitNFe> ConsultarPelaChave(string chaveAcesso) { chaveAcesso = chaveAcesso.Replace("NFe", ""); var consSit = new consSitNFe { chNFe = chaveAcesso, tpAmb = cfgServico.TipoAmbiente, versao = versao }; var xmlEvento = XmlUtils.ClasseParaXmlString <consSitNFe>(consSit); var arqEnv = Path.Combine("Logs", Arquivo.MontarNomeArquivo("pedConsSitNFe.xml", cfgServico)); await storage.SaveAsync(arqEnv, xmlEvento); var modeloDoc = chaveAcesso.Substring(20, 2).ModeloDocumento(); var sefazUrl = FabricarUrl.ObterUrl(eTipoServico.ConsultaSituacaoNFe, cfgServico.TipoAmbiente, modeloDoc, cfgServico.UF); var envelope = SoapEnvelopeFabrica.FabricarEnvelope(eTipoServico.ConsultaSituacaoNFe, xmlEvento); var retornoXmlString = await sefaz.TransmitirAsync(sefazUrl, envelope); var retornoXmlStringLimpa = Soap.LimparEnvelope(retornoXmlString, "retConsSitNFe").OuterXml; var arqRet = Path.Combine("Logs", Arquivo.MontarNomeArquivo("retConsSitNFe.xml", cfgServico)); await storage.SaveAsync(arqRet, retornoXmlStringLimpa); var retEnvEvento = new retConsSitNFe().CarregarDeXmlString(retornoXmlStringLimpa, xmlEvento); return(retEnvEvento); }
public void GetInstantaneousFlowData() { TimeRunner.Run(async(time, th) => { var entries = new Dictionary <(string uri, string soapAction, string soapBody), XElement> { { ("http://energywatch.natgrid.co.uk/EDP-PublicUI/PublicPI/InstantaneousFlowWebService.asmx", "http://www.NationalGrid.com/EDP/UI/GetInstantaneousFlowData", "<GetInstantaneousFlowData xmlns=\"http://www.NationalGrid.com/EDP/UI/\" />"), Soap.LoadBody("GetInstantaneousFlowData1") } }; var fakeSoapDownloader = new FakeSoapDownloader(entries); var flow = new InstantaneousFlow(th, fakeSoapDownloader); var stringsDir = new FakeDirectory(th); var strings = new Strings(th, stringsDir); var data = await(await flow.GetInstantaneousFlowDataAsync().ConfigureAwait(th)).WriteStringsAsync(th, strings).ConfigureAwait(th); Assert.Equal(258, data.Count); var nameIndex0 = await strings.AddOrGetIndexAsync("ALDBROUGH").ConfigureAwait(th); Assert.Equal(new InstantaneousFlow.Data(Instant.FromUtc(2017, 9, 15, 6, 24), InstantaneousFlow.SupplyType.ZoneSupply, (ushort)nameIndex0, Flow.Zero), data.First()); var nameIndex1 = await strings.AddOrGetIndexAsync("TOTAL SUPPLY").ConfigureAwait(th); Assert.Equal(new InstantaneousFlow.Data(Instant.FromUtc(2017, 9, 15, 6, 34), InstantaneousFlow.SupplyType.TotalSupply, (ushort)nameIndex1, Flow.FromCubicMetersPerHour(190.03944 * 1e6 / 24)), data.Last()); }); }
public IActionResult Get([FromQuery] string license) { string serviceName = "GetCarAssets"; string inXmlString = $@"<?xml version=""1.0"" encoding=""UTF-16""?><FEMIGetContactCarAssetsIn><License>{license}</License></FEMIGetContactCarAssetsIn>"; string inXml = HttpUtility.HtmlEncode(inXmlString); string soap = $@"<?xml version=""1.0"" encoding=""utf-8""?> <soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:cus=""http://siebel.com/CustomUI""> <soapenv:Header/> <soapenv:Body> <cus:_sblesc_spcRunWSDLInboundInt_Input> <cus:MethodName></cus:MethodName> <cus:ServiceName>{serviceName}</cus:ServiceName> <cus:inXML>{inXml}</cus:inXML> </cus:_sblesc_spcRunWSDLInboundInt_Input> </soapenv:Body> </soapenv:Envelope>"; string xml = Soap.Execute(soap, "_sblesc_spcRunWSDLInboundInt"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); string jsonText = JsonConvert.SerializeXmlNode(doc); return(Ok(JObject.Parse(jsonText))); }
public SoapPresentation(Soap soap) { InitializeComponent(); this._soap = soap; animationRunning = false; this._namespacesTable = new Hashtable(); }
/// <summary> /// Searches from an IP range. e.g. http://192.168.1, from http://x.x.x.1 through http://x.x.x.255, attempting to locate Wemo devices. /// </summary> /// <param name="ipAddressSeed">http://192.168.1</param> /// <returns></returns> public ConcurrentDictionary <string, string> GetListOfLocalWemoDevices(string ipAddressSeed) { if (string.IsNullOrWhiteSpace(ipAddressSeed)) { throw new Exception("The ipAddressSeed value is required!"); } var numProcs = Environment.ProcessorCount; var concurrencyLevel = numProcs * 2; var wemoDevices = new ConcurrentDictionary <string, string>(concurrencyLevel, 300); Parallel.For(1, 255, seed => { // Set the Ip Address var ipAddress = $"{ipAddressSeed}.{seed}"; // Verify the IP address is valid var validIpAddress = IPAddress.TryParse(ipAddress.Replace("http://", ""), out IPAddress address); // if the Ip address is not valid, then skip and get outta here... if (!validIpAddress) { return; } // Attempt to communicate with the Wemo device at the set Ip Address // Construct the HttpWebRequest - if not null we will use the supplied HttpWebRequest object - which is probably a Mock var request = GetResponseWebRequest ?? HttpRequest.CreateGetCommandHttpWebRequest($"{ipAddress}:{Port}{Event}", ContentType, SoapAction, Soap.WemoGetCommands.GetFriendlyName, RequestMethod); // Construct the Soap Request var reqContentSoap = Soap.GenerateGetRequest(Soap.WemoGetCommands.GetFriendlyName); var validWemoDevice = VerifyWemoDevice(request, reqContentSoap); // If we are not an actual Wemo device, then skip and get outta here... if (!validWemoDevice) { return; } var newRequest = GetResponseWebRequest ?? HttpRequest.CreateGetCommandHttpWebRequest($"{ipAddress}:{Port}{Event}", ContentType, SoapAction, Soap.WemoGetCommands.GetFriendlyName, RequestMethod); // Construct the Soap Request var response = ExecuteGetResponseAsync(newRequest, reqContentSoap).GetAwaiter().GetResult(); // If the Ip Address is truly a Wemo device, then deserialize and add it to the list if (response.StatusCode != "UnknownError") { var friendly = GetResponseObject <GetFriendlyNameResponse>(response); wemoDevices.TryAdd(ipAddress, friendly.FriendlyName); } }); return(wemoDevices); }
public void UpdateQuality_Soap_ReturnsSame() { Item item = new Soap(); item.Quality = 1; item.UpdateQuality(); Assert.AreEqual(1, item.Quality); }
public void UpdateSellIn_Soap_SameValue() { Item item = new Soap(); item.SellIn = 1; item.UpdateSellIn(); Assert.AreEqual(1, item.SellIn); }
/// <summary> /// Searches from an IP range. e.g. http://192.168.1, from http://x.x.x.1 through http://x.x.x.255, attempting to locate Wemo devices. /// </summary> /// <param name="ipAddressSeed">http://192.168.1</param> /// <returns></returns> public async Task <ConcurrentDictionary <string, string> > GetListOfLocalWemoDevicesAsync(string ipAddressSeed) { if (string.IsNullOrWhiteSpace(ipAddressSeed)) { throw new Exception("The ipAddressSeed value is required!"); } var numProcs = Environment.ProcessorCount; var concurrencyLevel = numProcs * 2; var wemoDevices = new ConcurrentDictionary <string, string>(concurrencyLevel, 300); await Task.Run(() => { Parallel.For(1, 255, async seed => { // Set the Ip Address var ipAddress = $"{ipAddressSeed}.{seed}"; // Verify the IP address is valid var validIpAddress = IPAddress.TryParse(ipAddress.Replace("http://", ""), out IPAddress address); // if the Ip address is not valid, then skip and get outta here... if (!validIpAddress) { return; } // Attempt to communicate with the Wemo device at the set Ip Address var request = CreateHttpWebRequest(Soap.WemoGetCommands.GetFriendlyName, ipAddress); // Construct the Soap Request var reqContentSoap = Soap.GenerateGetRequest(Soap.WemoGetCommands.GetFriendlyName); // Verify Wemo Device var validWemoDevice = VerifyWemoDevice(request, reqContentSoap); // If we are not an actual Wemo device, then skip and get outta here... if (!validWemoDevice) { return; } // Attempt to communicate with the verified Wemo device - we need to use a new Request object var newRequest = CreateHttpWebRequest(Soap.WemoGetCommands.GetFriendlyName, ipAddress); var response = await ExecuteGetResponseAsync(newRequest, reqContentSoap); // If the Ip Address is truly a Wemo device, then deserialize and add it to the list if (response.StatusCode != "UnknownError") { var friendly = GetResponseObject <GetFriendlyNameResponse>(response); wemoDevices.TryAdd(ipAddress, friendly.FriendlyName); } }); }); return(wemoDevices); }
private async Task <WemoResponse> GetBinaryStateResponseAsync(string cmd, HttpWebRequest request, string targetStatus) { WemoResponse response; // Construct the Soap Request var reqContentSoap = Soap.GenerateSetBinaryStateRequest(cmd, targetStatus); response = await ExecuteGetResponseAsync(request, reqContentSoap); return(response); }
/// <summary> /// Check to see if a given IP address is for a Wemo device. /// </summary> /// <param name="ipAddress">e.g. http://192.168.1.101</param> /// <returns>A KeyValuePair<string,string> populated with the ipaddress and friendly name if an existing Wemo device</string> object .</returns> public async Task <KeyValuePair <string, string> > IsLocalWemoDeviceAsync(string ipAddress) { if (string.IsNullOrWhiteSpace(ipAddress)) { throw new Exception("The ipAddressSeed value is required!"); } KeyValuePair <string, string> keyValuePair; // Verify the IP address is valid var validIpAddress = IPAddress.TryParse(ipAddress.Replace("http://", ""), out IPAddress address); // if the Ip address is not valid, then skip and get outta here... if (!validIpAddress) { return(new KeyValuePair <string, string>(ipAddress, null)); } // Attempt to communicate with the Wemo device at the set Ip Address var request = CreateHttpWebRequest(Soap.WemoGetCommands.GetFriendlyName, ipAddress); // Construct the Soap Request var reqContentSoap = Soap.GenerateGetRequest(Soap.WemoGetCommands.GetFriendlyName); // Verify Wemo Device var validWemoDevice = VerifyWemoDevice(request, reqContentSoap); // If we are not an actual Wemo device, then skip and get outta here... if (!validWemoDevice) { return(new KeyValuePair <string, string>(ipAddress, null)); } // Attempt to communicate with the verified Wemo device - we need to use a new Request object var newRequest = CreateHttpWebRequest(Soap.WemoGetCommands.GetFriendlyName, ipAddress); var response = await ExecuteGetResponseAsync(newRequest, reqContentSoap); // If the Ip Address is truly a Wemo device, then deserialize and add it to the list if (response.StatusCode != "UnknownError") { var friendly = GetResponseObject <GetFriendlyNameResponse>(response); //wemoDevices.TryAdd(ipAddress, friendly.FriendlyName); keyValuePair = new KeyValuePair <string, string>(ipAddress, friendly.FriendlyName); } else { keyValuePair = new KeyValuePair <string, string>(ipAddress, null); } return(keyValuePair); }
static void Main () { Soap soap = new Soap (); XmlDocument req = new XmlDocument (); req.LoadXml ("<returnval><obj type='Folder'>group-d1</obj><propSet><name>childEntity</name><val><ManagedObjectReference type='Folder'>group-d33</ManagedObjectReference><ManagedObjectReference type='Folder'>group-d36</ManagedObjectReference><ManagedObjectReference type='Folder' >group-d2</ManagedObjectReference><ManagedObjectReference type='Datacenter' >datacenter-3</ManagedObjectReference></val></propSet></returnval>"); XmlDocument resp = soap.RetrievePropertiesResponse (req); Assert.AreEqual ("RetrievePropertiesResponse", resp.DocumentElement.LocalName, "#1"); Assert.IsTrue (resp.OuterXml.IndexOf ("group-d33") != -1, "#2"); Assert.IsTrue (resp.OuterXml.IndexOf ("group-d36") != -1, "#3"); Assert.IsTrue (resp.OuterXml.IndexOf ("group-d2") != -1, "#4"); Assert.IsTrue (resp.OuterXml.IndexOf ("datacenter-3") != -1, "#5"); }
public IActionResult AddNewSoap(Soap _soap) //submit new Soap { if (ModelState.IsValid) { _db.Soap.Add(_soap); _db.SaveChanges(); return(Redirect(nameof(SoapList))); } else { return(View("CreateNewSoap")); } }
public static void SearchSubj(string ico) { string url = "https://eagri.cz/ssl/nosso-app/EPO/WS/v2Online/vOKOsrv.ashx"; string req = enveloReq.Replace("#BODY#", searchSubReq.Replace("#TIME#", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss")).Replace("#IC#", ico) ); string token = _sign("2ahKpoxgvuQRgFVsPUCX", req); req = req.Replace("#TOKEN#", token); Soap net = new Soap(); var resp = net.UploadString(url, req); }
public void QualityShouldNeverBeOver50(int quality) { // Arrange InventoryItem systemUnderTest = new Soap(1, quality); // Act systemUnderTest.MatureOvernight(); // Assert systemUnderTest.Quality.ShouldBe(50); }
public void SellInShouldNeverBeLessThan1(int sellIn) { // Arrange InventoryItem systemUnderTest = new Soap(sellIn, 1); // Act systemUnderTest.MatureOvernight(); // Assert systemUnderTest.SellIn.ShouldBe(1); }
public async Task <WemoResponse> GetResponseAsync(Soap.WemoGetCommands cmd, string ipAddress) { WemoResponse response; // Construct the HttpWebRequest var request = CreateHttpWebRequest(cmd, ipAddress); // Construct the Soap Request var reqContentSoap = Soap.GenerateGetRequest(cmd); response = await ExecuteGetResponseAsync(request, reqContentSoap); return(response); }
public void ValuesShouldNotChangeInRange(int sellIn, int quality) { // Arrange InventoryItem systemUnderTest = new Soap(sellIn, quality); // Act systemUnderTest.MatureOvernight(); // Assert systemUnderTest.SellIn.ShouldBe(sellIn); systemUnderTest.Quality.ShouldBe(quality); }
public List <string> getList() { GetListRequest req = new GetListRequest(); req.user = new User(); req.user.login = conf.Login; req.user.pass = Utils.GetMD5String(conf.Soap_pass); GetListResponse resp = (GetListResponse)Soap.GetList <GetListResponse>(req); if (resp.errorCode != 0) { throw new Exception(resp.errorMessage); } return(resp.list); }
public async Task <WemoResponse> GetResponseAsync(Soap.WemoGetCommands cmd, string ipAddress) { WemoResponse response; // Construct the HttpWebRequest - if not null we will use the supplied HttpWebRequest object - which is probably a Mock var request = WebRequest ?? HttpRequest.CreateGetCommandHttpWebRequest($"{ipAddress}:{Port}{Event}", ContentType, SoapAction, cmd, RequestMethod); // Construct the Soap Request var reqContentSoap = Soap.GenerateGetRequest(cmd, "urn:Belkin:service:insight:1"); response = await ExecuteGetResponseAsync(request, reqContentSoap); return(response); }
public void Fetch() { TimeRunner.Run(async(time, th) => { var entries = new Dictionary <(string uri, string soapAction, string soapBody), XElement> { { ("http://energywatch.natgrid.co.uk/EDP-PublicUI/PublicPI/InstantaneousFlowWebService.asmx", "http://www.NationalGrid.com/EDP/UI/GetLatestPublicationTime", "<GetLatestPublicationTime xmlns=\"http://www.NationalGrid.com/EDP/UI/\"/>"), Soap.LoadBody("GetLatestPublicationTime1") }, { ("http://energywatch.natgrid.co.uk/EDP-PublicUI/PublicPI/InstantaneousFlowWebService.asmx", "http://www.NationalGrid.com/EDP/UI/GetInstantaneousFlowData", "<GetInstantaneousFlowData xmlns=\"http://www.NationalGrid.com/EDP/UI/\" />"), Soap.LoadBody("GetInstantaneousFlowData1") } };
public void AddMethod(string methodName, string[][] args) { string apiUri = "http://emailservice/"; var method = Soap.CreateElement("api:" + methodName, apiUri); //method.Prefix = "api"; foreach (var arg in args) { var ele = Soap.CreateElement(arg[0]); ele.InnerText = arg[1]; method.AppendChild(ele); } Body.AppendChild(method); }
public byte[] getDoc(string name) { GetDocRequest req = new GetDocRequest(); req.user = new User(); req.user.login = conf.Login; req.user.pass = Utils.GetMD5String(conf.Soap_pass); req.fileName = name; GetDocResponse resp = (GetDocResponse)Soap.GetDoc <GetDocResponse>(req); if (resp.errorCode != 0) { throw new Exception(resp.errorMessage); } return(Utils.Base64DecodeToBytes(resp.content, "UTF-8")); }
public bool archiveDoc(string name) { ArchiveDocRequest req = new ArchiveDocRequest(); req.user = new User(); req.user.login = conf.Login; req.user.pass = Utils.GetMD5String(conf.Soap_pass); req.fileName = name; ArchiveDocResponse resp = (ArchiveDocResponse)Soap.ArchiveDoc <ArchiveDocResponse>(req); if (resp.errorCode != 0) { Logger.log("ERROR: " + resp.errorMessage); throw new Exception(resp.errorMessage); } return(resp.errorCode == 0); }
public void GetLatestPublicationTime() { TimeRunner.Run(async(time, th) => { var entries = new Dictionary <(string uri, string soapAction, string soapBody), XElement> { { ("http://energywatch.natgrid.co.uk/EDP-PublicUI/PublicPI/InstantaneousFlowWebService.asmx", "http://www.NationalGrid.com/EDP/UI/GetLatestPublicationTime", "<GetLatestPublicationTime xmlns=\"http://www.NationalGrid.com/EDP/UI/\"/>"), Soap.LoadBody("GetLatestPublicationTime1") } }; var fakeSoapDownloader = new FakeSoapDownloader(entries); var flow = new InstantaneousFlow(th, fakeSoapDownloader); var instant = await flow.GetLatestPublicationTimeAsync().ConfigureAwait(th); Assert.Equal(Instant.FromUtc(2017, 9, 7, 16, 23, 0), instant); }); }
public override void Update(Proxy.NodeType nodeType, ref Soap.TransactionFramework.TransactionChain chain) { if (Facade != null) { TransactionFramework.AddNodeTransactionLink addNodeTransaction = Facade.TransactionOrigin as TransactionFramework.AddNodeTransactionLink; if (addNodeTransaction != null) { if (addNodeTransaction.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient) { addNodeTransaction.NodeType = nodeType; return; } } } DelayedActions.Enqueue(new DelayedNodeAction() { Action = Proxy.TransactionActionType.TypeUpdated, NodeType = nodeType }); }
public override void Update(RelationshipType relationshipType, ref Soap.TransactionFramework.TransactionChain chain) { if (Facade != null) { AddRelationshipTransactionLink addRelationshipTransaction = Facade.TransactionOrigin as AddRelationshipTransactionLink; if (addRelationshipTransaction != null) { if (addRelationshipTransaction.TransactionStatus == ServerStatus.ProcessingClient) { addRelationshipTransaction.RelationshipType = relationshipType; return; } } } DelayedActions.Enqueue(new DelayedRelationshipAction() { Action = TransactionActionType.TypeUpdated, RelationshipType = relationshipType }); }
public override void ConnectNode(Proxy.ConnectionType connectionType, Proxy.INode node, ref Soap.TransactionFramework.TransactionChain chain) { base.ConnectNode(connectionType, node, ref chain); if (Facade != null) { TransactionFramework.AddRelationshipTransactionLink addRelationshipTransaction = Facade.TransactionOrigin as TransactionFramework.AddRelationshipTransactionLink; if (addRelationshipTransaction != null) { if (addRelationshipTransaction.TransactionStatus == TransactionFramework.ServerStatus.ProcessingClient) { addRelationshipTransaction.AddNode(connectionType, node); return; } } } DelayedActions.Enqueue(new DelayedRelationshipAction() { Action = Proxy.TransactionActionType.Updated, ConnectionType = connectionType, Node = node }); }