简体   繁体   中英

Do the various styles of Web Services differ in performance?

So we have JAX-WS that is SOAP based and can be either RPC Style or Document Style . These are also called as Big Webservices

Also the above two have the options of using encoded or literal styles.

Then we have JAX-RS, the RESTful version of Webservices. As per my knowledge this style is used for building light web services and also webservices that don't generate dynamic data so the result can be cached. No WSDL required. This also does not support authentication(I think).

Do these styles differ in performance or speed of execution ?

I have an application that uses Webservices to access database that is behind the firewall.(Exposing data as a Service- I am using a tool called WSO2 ) The queries execute fast but the webservices take time in formatting the data in XML so my application slows down.

Will my performance improve if I use different styles of Webservices ?

RESTful webservices do support authentication, the easiest being HTTP Basic AUTH.

Naturally there are differences in performance, depending on what kind of things you're doing. However it's unlikely that the type of the WebService would be important in improving performance. It's more about what the WS is doing. The real hotspots are in your business code.

REST is more lightweight in terms of troughput compared to SOAP, because only a minimum of data gets transfered over HTTP. You can find more information in this great thread .

For SOAP, and the difference between RPC/encoded, RPC/literal, Document/encoded, Document/literal and when to use each, you can check out this article . It touches on performance - it is mainly related to having type encoding vs not having.

You say that queries (and I assume business logic as well) are pretty fast. So if you want to optimize for performance in your case you should first analyze network connectivity - speed, latency, bandwidth and then maybe take a closer look at the message transformation logic in case you do something too heavy.

Few points to differentiate web services and REST.

SOAP/web services (SOA)

  • Strict contracts/service definitions such as WSDL/XSDs
  • Complex message formats - SOAP
  • Complex security protocols - WS-Security, WS-Trust/Federation etc.

REST- - Loose contracts with simple message formats (JSON, XML) - API definitions via simple standards such as Swagger . http://swagger.io/ - Lightweight protocols such as basic-auth/OAuth 2.0/OpenID Connect.

My recommendation is that you should select web services or REST based on business requirements but not based on the performance (Of course with strict validations in SOAP web services, there will be a performance hit)

It is also important for keep in mind that REST based business functionalities/services are the key driving force of the APIs and API-Management[1].

[1] http://www.slideshare.net/kasun04/api-integration-and-soa-convergence

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM