.net调用动态库NationECCode.dll使用电子凭证二维码解码接口
C#.net调用示例代码:
[DllImport("NationECCode.dll", CallingConvention = CallingConvention.StdCall)] public static extern void NationEcTrans(string url, string input, IntPtr output); public static string inOut(string url, string input) { IntPtr outPut = System.Runtime.InteropServices.Marshal.AllocHGlobal(2048); NationEcTrans(url, input, outPut); string retStr = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(outPut); System.Runtime.InteropServices.Marshal.FreeHGlobal(outPut); return retStr; } static void Main(string[] args) { string toUrl = "http://172.16.33.247/localcfc/api/hsecfc/localQrCodeQuery"; string inPut = "{\"data\":{\"businessType\":\"01203\",\"deviceType\":\"\",\"officeId \":\"32760\",\"officeName\":\"123\",\"operatorId\":\"test001\",\"operatorName\":\"456\",\"orgId\":\"35020319001\"},\"orgId\":\"35020319001\",\"transType\":\"ec.query\"}"; string outPut= inOut(toUrl, inPut); Console.WriteLine("出参:"+ outPut); Console.Read(); }
测试解码正常。