Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
tokenExchange
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Runtime.Serialization; using System.Threading.Tasks; using System.Net; using Newtonsoft.Json.Linq; using System.Diagnostics; using System.Xml.Linq; using System.Text; using System.IO; using System.Net.Http; namespace Rextester { public class Program { private static readonly HttpClient client = new HttpClient(); public static void Main(string[] args) { //Your code goes here //DownloadData(); //var data = wc.DownloadString("https://jsonplaceholder.typicode.com/posts/1"); //Console.WriteLine(data); //XDocument doc = new XDocument(); //doc.Declaration = new XDeclaration("1.0", "utf-8", null); XNamespace xNamespace = "http://schemas.nav.gov.hu/OSA/1.0/api"; XElement root = new XElement(xNamespace+ "TokenExchangeRequest", new XElement(xNamespace + "header", new XElement(xNamespace + "requestId", "RIDDn0Vt4Nh8Fb6"), new XElement(xNamespace + "timestamp", "2018-05-04T09:51:13.268Z"), new XElement(xNamespace + "requestVersion", "1.0"), new XElement(xNamespace + "headerVersion", "1.0") ), new XElement(xNamespace + "user", new XElement(xNamespace + "login", "11"), new XElement(xNamespace + "passwordHash", "CF83E1357EEFB8BDF1542850D66D8007D620E4050B5715DC83F4A921D36CE9CE47D0D13C5D85F2B0FF8318D2877EEC2F63B931BD47417A81A538327AF927DA3E"), new XElement(xNamespace + "taxNumber", ""), new XElement(xNamespace + "requestSignature", "091DF3928D97031A686E91005493E301FD1010F3E5C2E671173FDCE9A1BAA256C785BB7F0FB85E030B26225963A401779B2F1BD937CFA48281500102B4DD6027") ), new XElement(xNamespace + "software", new XElement(xNamespace + "softwareId", ""), new XElement(xNamespace + "softwareName", "NAV Online Invoice Tester"), new XElement(xNamespace + "softwareOperation", "LOCAL_SOFTWARE"), new XElement(xNamespace + "softwareMainVersion", "1.0"), new XElement(xNamespace + "softwareDevName", "1.0"), new XElement(xNamespace + "softwareDevContact", "1.0"), new XElement(xNamespace + "softwareDevCountryCode", "HU"), new XElement(xNamespace + "softwareDevTaxNumber", "") ) ); // Console.WriteLine(root.ToString()); try { var request = (HttpWebRequest)WebRequest.Create("https://api-test.onlineszamla.nav.gov.hu/invoiceService/tokenExchange"); var data = Encoding.ASCII.GetBytes(root.ToString()); request.Method = "POST"; request.ContentType = "application/xml"; request.ContentLength = data.Length; using (var stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } var response = (HttpWebResponse)request.GetResponse(); var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); } catch (WebException ex) { var responseString = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd(); Console.WriteLine(responseString); } //var wc=new WebClient(); //var data = wc.DownloadString("https://api-test.onlineszamla.nav.gov.hu/invoiceService/tokenExchange"); } } }
run
|
edit
|
history
|
help
0
Linked list solution with remove
test array with c#
ö1
Par ou ímpar input
System Convert
JJ 2
GetMyAppintmentData
Math Operations
dfgthyjui8u7yt5rewsx
Assignment