1

I've been using the following code to create my android OData service consumer.

Services = ODataConsumer
           .newBuilder("http://xxx.xxx.xxx.xxx:xxxxx/WCFDataServices.svc/")
           .setFormatType(FormatType.JSON).build();

What I want to know is when the client makes a request through the Services consumer will the request make the server create a JSON formatted response or will the OData4j/consumer convert the response to JSON format.

Thanks in advance for the help. :)

4

2 回答 2

0

Odata 默认格式为 ATOM。如果您愿意,您可以将其更改为 JSON,就像您已经在做的那样。

“格式类型.JSON”

OData4j/consumer API 负责将响应类型转换为您定义的任何格式。

于 2013-04-05T12:38:02.360 回答
0

它使用 Accept 请求标头从服务器请求 JSON 响应。它没有转换。

请参阅:http ://code.google.com/p/odata4j/source/browse/odata4j-jersey/src/main/java/org/odata4j/jersey/consumer/ODataJerseyClient.java#175

希望有帮助,
-约翰

于 2012-05-05T15:29:56.420 回答