OData Feed(不在我的控制范围内)- 我可以压缩 (gzip) 或通过 JSON 发送它吗?
我正在尝试使用基于 OData Web 的 XML 网络服务(基于 AtobPub 协议)。我无权访问服务器,因此无法启用压缩(我知道它未设置)。有些有效载荷相当大。
我想知道从客户端开发人员的角度来看,可以做些什么来更好地使用这些服务。手动压缩和解压缩 xml 负载? JSON 怎么样,这可能吗?
任何建议将不胜感激。
更新 (02/29/2012): 经过迄今为止的一次回复,我想澄清一下,我是这些服务的消费者,而不是生产者。对托管这些服务和应用程序的服务器有严格的限制,并且不幸的是,未设置压缩,因此 xml 服务通过非 gzip 压缩(根本不压缩)。服务器是异构的,Linux 和 Windows 混合在一起。作为开发人员,在创建 DAL、BLL、UI 等时,我可以做什么来确保请求/响应被压缩?通过自己的GZip压缩算法/函数实现XML消息的解压缩?
I am trying to consume an OData web-based web service that is XML (based on AtobPub protocol). I don't have access to the server and thus cannot enabled compresssion (I know it is not set). Some of the payloads are quite large.
I am wondering what one can do from a client-side developer's point-of-view, to better consume these services. Manually compress and decompress the xml payloads? How about JSON, is this possible?
Any advice will be greatly appreciated.
UPDATE (02/29/2012): After one response so far, I would like to clarify that I am a consumer of these services and not the producer. There is a strict restriction to the servers that these services and applications are hosted on and compression, unfortunately, is not set and thus the xml services come through non-gzipped (not compressed at all). The servers are heterogeneous with Linux and Windows in the mix. As a developer, creating the DAL, BLL, UI, etc., what can I do to make sure the Requests/Responses are compressed? Implement by own GZip compression algorithm/function and decompression of XML messages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果服务器支持,您应该能够请求 JSON。通常通过将请求上的 Accept 标头设置为 application/json。或者某些服务器甚至支持将 $format=json 添加到 URL 以实现此目的。
If the server supports it you should be able to request JSON. Typically by setting Accept header on your request to application/json. Or some servers even support adding $format=json to the URL for this purpose.