简体   繁体   中英

SOAP to Rest Service Using Adapter

I have a legacy project where it has SOAP webservices exposed. Now I have a requirement to convert them to rest and use it accordingly.

Can I have implementation like Jersey available to consume these soap services and then publish the same as REST?

This is a common problem when dealing with legacy APIs. Since REST is not a protocol by definition you can implement either:

  • Protocol Bridging Pattern . It is a common SOA pattern that helps you transform between different protocols by using a bridging broker as intermediary. The broker holds the transformation logic. You can find more information here . Such bridges are available in most ESBs and EAI middle-wares. 协议桥接模式

  • Data Format Transformation Pattern . It transforms between data formats and you can use it to transform from XML to the REST format you are using. You can implement it by putting in some internal service logic, service agents, or a dedicated transformation service. You can see more here. . You can absolutely use Jersey to build a REST Facade and transform internally from XML, or build the logic inside each service. 数据格式转换模式

It really depends on the size of your API and the type of solution you need. For few services I will choose the second approach - it's easier but a bit more coupled, while if I have many services I'd go for the first approach, which in my opinion abstracts transformation logic better, but it may require additional middleware and effort.

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