开发者

How to expose locally installed application as Web Service?

开发者 https://www.devze.com 2023-03-04 13:07 出处:网络
Supp开发者_如何学JAVAose I have 2 web services A and B in SOA project. Bothweb services are running on a remote servers. Web Service A depends on information available from only a locally installed de

Supp开发者_如何学JAVAose I have 2 web services A and B in SOA project. Both web services are running on a remote servers. Web Service A depends on information available from only a locally installed desktop application on a human actor machine and thats all web service A does i.e. provide this information). There are hundreds of such human actors with the same locally installed application providing its own information that web service A needs. Web service B needs this information from web service A, the result of which (which is the whole benefit of this project) is provided to that human actor who originated this process (by loging into system and clicking some command button). So this human actor is acting like the consumer of Web service B. The question is how can I make this locally installed application act as Web Service A (in the context of SOA project)?

This question could best be answered by some one with extensive experience in Web services and SOA.

This SOA project uses java, like ESB based on Java and there is no Microsoft specific services running although the desktop application is a Windows application. The application provides c/C++ API for an external process to call and retrieve the information needed by Web service A. What I want is the both web services A and B are hosted on remote server and interacting with each other via ESB but the problem is how to make local application information available to Web Service A?


There are two types of solutions

The first: have the original client application add a parameter with the address of web service A, and use this address for calling the service.

The second: pass a more abstract user identifier from the client (actually, there's a good chance you have such a field in the service). and use a translation service to retrieve the physical address corresponding to this id. To allow such translation, the desktop application that acts as a server needs to "register" with the translation service when starting up.

If you are using an ESB, or other SOA infrastructure (like a service directory, message queuing service) it will include much of the functionality you need to build the translation service.

regarding the actual hosting of the service in the client machine.

the simplest solution is to use a different process from the actual application, and just access the files or DB the application uses. In this case you can use any infrastructure you like to develop the service.

a more complex scenario is when you need the actual application to supply the service. in this case you will need to have a thread in the application that listens to service requests. if you are using WCF see Hosting Services about how to host a web service in your application.

EDIT

some additions regarding you clarification.

as I understand, the desktop application exposes a C\C++ API that is available for external processes on the same machine.

You can either write a web service that will use this API. Googling "C++ Web Services Windows" will give yo several relevant pointers on implementing those.

Another good option is to use a messaging infrastructure. most JMS providers provide API's in languages other then Java - including C++. Your application will be a C++ windows service that listens and sends messages to you JMS provider.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号