简体   繁体   中英

WebSphere 8.5: service acting as client to another RESTFul WebService

Does WebSphere 8.5 (Java EE 6) support in any way services (Servlets, EJBs,...) acting as clients to another RESTFul WebService? Eg by managing their HTTP connections?

The only link I've found so far is some supprt for services acting as clients to another JAX-RCP webservice using the ibm-webservicesclient-bnd.xmi descriptor:

http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frwbs_assembpropclient.html

http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/twbs_configaddhttppropertiesatk.html

Is there a client descriptor for RESTFul webservice clients, which could be used from a service?

EDIT

To make it more clear what I'm looking for:

Currently we create a RESTFul client in the service using WebResource , ApacheHttpClient , ApacheHttpClientHandler from Jersey and HttpClient from Apache . This is done programmatically, not declaratively, so WebSphere is not aware of these clients and the connections/ sockets they are using.

I'm looking for a way to create clients with resources managed by WebSphere, so I could do somehing like:

@Resource
private SomeResource someResource;

....

SomeClient client = new SomeClient(someResource);

or something similar. It could be something WebSphere specific. There could also be another way to get the resource than to inject it with @Resource.

But it should be WebSphere who manages and creates the max. number of connections, sockets, timeouts, pooling etc. and should allow to monitor these resources.

So something similar as we're using with JMS when we want to send messages to a topic or a queue:

@Resource
private ConnectionFactory connectionFactory;

@Resource
private Topic someTopic;

@Resource
private Queue someQueue;

Just that this time we want to send a request to another RESTFul webservice.

Unfortunately, with WAS 8.5, you can't.

WAS 8.5 (or even the latest, 8.5.5) supports Java EE 6.0 and JAX-RS 1.2. The JAX-RS 1.2 specification only deals with JAX-RS from the "server" point of view (that is, hosting RESTful services), but not the "client" point of view.

Therefore, with WAS 8.5, your only choice for JAX-RS client programming is using proprietary APIs and libraries such as the ones you're using. You can of course wrap those APIs in such a way that you can inject connections (possibly using CDI), but it's not available for you out of the box.

WAS 8.5 ships with a REST client, though - Apache Winks.

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