简体   繁体   中英

C# - What is the way to Call a Service from Another Service in a SOA Architecture?

We are trying to implement a SOA architecture at my job.

We have situations where RESTFul web services will need to call other SOAP web services.

Normally I would add a web reference in Service A to Service B but in SOA loose coupling is preached. So how do I call Service B from Service A?

The "proper" way is to have some Service Registry where you'd look up the second service by the contract you need etc. Another "proper" way is to have some orchestrator (eg an ESB) and it would integrate the two services etc.

The question is how many services and integrations you have and is the overhead worth it. If you have just a few services I suggest you do the simplest thing first (ie add a reference) and add infrastructure and complexity when it would make sense - ie when the overhead by managing this dependencies will be heavier than the overhead of adding more infrastructure

You need to look at the message translator enterprise integration pattern. This is essentially a translator that sits between the two services.

One approach would be is to create a service that is the message translator itself this service will orchestrate the two services ie service A and service B. People will not call the rest service directly but this new message translator service. This translator service will have knowledge of A and B. Thus those two services are loosely coupled from each other(A not coupled to B).

The other would be to proxy the REST service(A) on a ESB and send the reply through a message translator to the SOAP service(B).

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