我可以在Android应用程序中使用REST和SOAP吗?

时间:2021-08-02 20:15:51

I am trying to build an Android application.

我正在尝试构建一个Android应用程序。

It has a SOAP-based Web service from which it needs to consume the data.
I have a middle-ware Worklight server implementation too.

它有一个基于soap的Web服务,它需要使用它来消耗数据。我也有一个中间件的Worklight服务器实现。

The data coming from the Web Service is huge and is actually all the data is not needed all the time. I was planning that I would use the middleware Worklight server to consume the SOAP web service, rather than the Android app itself, parse the data and then expose the required bits as a RESTful service and the data format JSON rather than SOAP XML format.

来自Web服务的数据是巨大的,实际上所有的数据都不需要。我计划使用中间件Worklight服务器来使用SOAP web服务,而不是使用Android应用程序本身,解析数据,然后将所需的比特作为RESTful服务和数据格式JSON(而不是SOAP XML格式)公开。

I think that this will take the load of parsing the huge XML data off the app. Is this a good approach?

我认为这将承担解析应用程序中巨大的XML数据的工作量。这是一个好方法吗?

1 个解决方案

#1


0  

I see no problem with your overall design, i.e. consuming the large chunk of data from the SOAP call in your middleware server and then only exposing the specific things you need for your Android clients.

我认为您的总体设计没有任何问题,即从您的中间件服务器中使用SOAP调用的大量数据,然后只公开您的Android客户端需要的特定内容。

It will at least save you bandwidth on your Android devices (which is a really good thing) and most likely a few lines of code in your Android project since your REST data will be tailored for your specific use-cases.

它至少可以节省你在Android设备上的带宽(这是一件非常好的事情),而且很可能在你的Android项目中有几行代码,因为你的REST数据将根据你的具体用例进行调整。

JSON or XML? What better fits your needs.

JSON或XML ?什么更适合你的需要。

I'd advice you to look at versioning your REST services though. This is a good start: Best practices for API versioning?

不过,我建议您看看REST服务的版本。这是一个好的开始:API版本控制的最佳实践?

#1


0  

I see no problem with your overall design, i.e. consuming the large chunk of data from the SOAP call in your middleware server and then only exposing the specific things you need for your Android clients.

我认为您的总体设计没有任何问题,即从您的中间件服务器中使用SOAP调用的大量数据,然后只公开您的Android客户端需要的特定内容。

It will at least save you bandwidth on your Android devices (which is a really good thing) and most likely a few lines of code in your Android project since your REST data will be tailored for your specific use-cases.

它至少可以节省你在Android设备上的带宽(这是一件非常好的事情),而且很可能在你的Android项目中有几行代码,因为你的REST数据将根据你的具体用例进行调整。

JSON or XML? What better fits your needs.

JSON或XML ?什么更适合你的需要。

I'd advice you to look at versioning your REST services though. This is a good start: Best practices for API versioning?

不过,我建议您看看REST服务的版本。这是一个好的开始:API版本控制的最佳实践?