开发者

SOAP to Restlets strategy for multiple methods

开发者 https://www.devze.com 2023-03-11 18:20 出处:网络
I\'ve been working with the Restlet library for the last couple weeks and from what I can see it is fairly impressive. The ability to be able to define a common interface for consumption by both the c

I've been working with the Restlet library for the last couple weeks and from what I can see it is fairly impressive. The ability to be able to define a common interface for consumption by both the client and server surpasses any messy soap frameworks I've worked with.

However, something has been plaguing my mind that I just can get past:

Is there a good way to define Restlets with many methods?

My primary use case is that I have a soap web service that has 10-15 or so methods in it. As I see it, if I wish to translate this over to a Restlet I will need to separate this out into 8-15 interfaces depending on wh开发者_StackOverflow社区ich methods become get methods vs post or put - I don't think you can have more than one verb method (get, post, put, etc) per interface. This seems like a cumbersome and clumsy solution.

I've thought of using some type of factory\map technique to mitigate this - but I wanted to make sure I'm not missing something better first.

Thanks


Even though coming from a SOAP background, it might be surprising, what you observe it actually a good thing because your web API is becoming more and more RESTful.

In REST/HTTP, methods are standard and limited (by design) and to compensate we create as many resources/URis as necessary.

Regarding JAX-RS, it doesn't have the same client/server uniformity. I would recommend staying with the core Restlet API in general as it is more powerful/extensible.

If you could list your method names, that would help suggest a proper mapping to HTTP resource and methods, I'm not sure you need that many interfaces in the end. Even if this is the case, there server-side implementation will be easy and more maintainable which also has benefits.

Hope this helps


There's a JAX-RS extension for Restlet. JAX-RS provides the @Path annotation that is used identify the URI of the resource. Paths can be attached either to the type or to a method. Routing should be then done by the container instead of explicitly defining router rules.

0

精彩评论

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