从 Web URL 检索 JSON
这可能是一个非常无知的问题,请做好准备。我正在合作的一家公司提供了一个“API”,我可以用它来访问订单,但是,只有两个真正的命令:getorders 和 getorderdetails。这些命令的格式为 www.server.com/path/to/the/orderapi/getorders/UniqueKey/
如果我访问该网址,系统会提示我输入用户名和密码,一旦通过身份验证,就会看到一个 JSON 格式的订单详细信息页面,包含在 html 页面的正文中。我想要一个服务来检查此信息并根据它在我们的 CRM 中创建订单,是否有一种明显的方法可以在无需浏览器/客户端交互的情况下访问它?
更新:我们打算使用 BizTalk 来使用此资源,但经过一些研究和实验后决定使用不同的服务 (WDSL),主要是因为 BizTalk 似乎没有很好的支持宁静的网络服务。如果对这个主题有更多了解的人愿意插话,那对我来说很好。
更新2:注意到stackoverflow上的(已删除的)线程基本上是biztalk 2009-r2的反馈线程,其中一个请求是支持restful web服务,所以我认为不存在是 BizTalk 2009 中宁静服务的优雅解决方案。
This may be a terribly uninformed question, brace yourself. A company I'm working with has given an 'API' that I can use to access orders, however, there are only two real commands, getorders and getorderdetails. These commands are put in the format of www.server.com/path/to/the/orderapi/getorders/UniqueKey/
If I go to that web address, I'm prompted for a username and password, and once authenticating, get presented with a page of JSON formatted order details, contained in the body of the html page. I would like a service to check this information and create orders in our CRM based on it, is there an obvious way to access it without the browser/client interaction?
Update: We intended to Use BizTalk to consume this resource but after a bit of research and experimenting have decided to use a different service (WDSL), mainly because BizTalk doesn't seem to have terribly great support for Restful webservices. If anyone with more knowledge of the subject would like to chime in that's fine by me.
Update 2: Noticed that (a since deleted) thread on stackoverflow is basically a feedback thread of biztalk 2009-r2, and one of the requests is support for restful web services, so I don't think there is a graceful solution for restful services in BizTalk 2009.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用您选择的语言以及一些支持 HTTP 的库,然后开始破解?
在 PHP 中,您可以使用内置的 cURL 库来发出 HTTP 请求。您可以获取 JSON 数据,通过 json_decode() 运行它以创建本机 PHP 数据类型,然后随意对其进行操作,执行在 CRM 中创建订单所需的任何操作。
Use your language of choice, along with some library that speaks HTTP, and start hacking away?
In PHP, you'd use the build-in cURL library to make the HTTP requests. You'd grab the JSON data, run it through json_decode() to create native PHP datatypes, and then operate on them at will, doing whatever you need to do to create orders in your CRM.