【发布时间】:2012-10-09 10:03:31
【问题描述】:
我目前正在运行一个网络服务,将调用返回到我构建的 iPhone 客户端。 Web 服务以肥皂的形式返回 xml。
我们注意到,当我们使用特定功能时,就用户体验而言,调用所需的时间比接受的时间长。
这是一些示例代码和示例 xml
功能
public List<Foo> bar(....)
{
// stuff
return Bar;
}
结果被序列化为 XML 并在 iPhone 客户端中使用。
函数返回的 XML 示例。(此 xml 可能会变得非常大,具体取决于用户使用客户端应用程序的方式)。
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<response xmlns="uri:Foo">
<result>
<p>
<num>string</num>
<d>int</d>
<pf>string</pf>
<pt>string</pt>
<ipk>boolean</ipk>
<ipa>boolean</ipa>
<va>
<ava xsi:nil="true" />
<ava xsi:nil="true" />
</va>
<dps>
<dp xsi:nil="true" />
<dp xsi:nil="true" />
</dps>
<dst>string</dst>
</p>
</result>
</response>
</soap:Body>
</soap:Envelope>
我基本上想要的是使数据更小。最好通过某种压缩。
是否可以在返回给 iPhone 客户端之前压缩 XML 的大小?
我查看了gzip,但无法真正掌握它,因为它适用于流。
任何提示和/或指针将不胜感激。谢谢阅读。
【问题讨论】:
标签: c# web-services xml-parsing compression gzip