VS C ++ windows表单使用webservices发送JSON请求 [英] VS C++ windows forms send JSON request with webservices

查看:76
本文介绍了VS C ++ windows表单使用webservices发送JSON请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这应该是相对微不足道的,并且有机会做一些科学。



我有一个Windows窗体项目显示&检测图像中的点源(星星)。点源位置可以是双列阵,也可以根据需要写入文本文件等。



这些x / y位置需要发送到天体测量。世界坐标系拟合网。他们在这里指定他们的API JSON接口规则:



Nova.astrometry .net:API - Astrometry.net主文档 [ ^ ]



但这不是我熟悉编码的东西。好像我应该能够使用webservices。基本上只有一两个请求然后等待输出。



我的想法是我需要一切,我只需要知道如何发送请求和放大器;数据并使用webservices读取响应。这将在表单上的按钮内运行。我需要监视服务器的输出一两分钟,因为它解决了解决方案,因此我会将该部分放入计时器,在后台工作程序中运行,以便它可以取消等等。我知道如何做所有那个windows-formy VS c ++的东西......不熟悉使用webservices发送JSON请求并读取输出。



干杯。



我的尝试:



还没有。我可以在睡眠中编写Windows窗体和定时器以及后台工作程序和数据分析等代码。只是不熟悉webservices。他们提供的API说明应该让那些知道他们正在使用JSON和Web服务做什么的人变得微不足道。

解决方案

如果您对Windows上的C ++感到满意 - 请查看将开源JSON解析器与作为Windows一部分的WinHttp API相结合。



关于WinHTTP(Windows) [ ^ ]



JSON解析器有很多选择:



GitHub - miloyip / nativejson -benchmark:C / C ++ JSON解析器/生成器基准测试 [ ^

This should be relatively trivial, and an opportunity to do some science.

I have a windows forms project that displays & detects point sources (stars) in an image. The point source locations can be in double arrays, or written to text file, etc., as needed.

These x/y locations need to be sent to astrometry.net for World Coordinate System fitting. They specify their API JSON interface rules here:

Nova.astrometry.net: API — Astrometry.net master documentation[^]

but this is not something I'm familiar with coding. Seems like I should just be able to use webservices. There is basically just a request or two and then waiting for output.

The idea is that I have everything required, I just need to know how to send the request & data and read the response, using webservices. This would be run inside a button press on the form. I would need to monitor the output from the server for a minute or two as it solves the solution, and so I would put that part in a timer, run in a backgroundworker so that it was cancellable, etc. I know how to do all that windows-formy VS c++ stuff...just not familiar with using webservices to send JSON requests and read the output.

Cheers.

What I have tried:

Nothing yet. I can code windows Forms and timers and background workers and data analysis etc. in my sleep. Just not familiar with webservices. The API instructions they provide should make it trivial for someone who knows what they're doing with JSON and webservices.

解决方案

If you are comfortable in C++ on Windows - look at combining a open source JSON parser with the WinHttp API that is a part of Windows.

About WinHTTP (Windows)[^]

Lots of choices for a JSON parser:

GitHub - miloyip/nativejson-benchmark: C/C++ JSON parser/generator benchmark[^]


这篇关于VS C ++ windows表单使用webservices发送JSON请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆