users@wadl.java.net

Re: Multiple GET methods for same resource

From: Sebastian Paul <me_at_sebpaul.de>
Date: Thu, 10 Jun 2010 15:56:34 +0200

Hi,
let me explain why there are multiple GET requests with same media type:

We have a legacy web service where we cannot change the interface.
There is one servlet that is accessed with a fixed path.
This servlet takes a parameter "command", whose value (a number)
determines the method.
All methods are accessed with GET or alternatively POST, and all of them
return XML.
e.g. /ServerContext/ServletPath?command=X

I tried SoapUI to create a WADL for this service. The Servlet is my
resource, and the different commands are the methods. Each of them
defines the command parameter, with the correct number as default. This
works nice to test the service in SoapUI, but the code which is
generated by wadl2java defines many methods with the same name
"getAsApplicationXml", but with different parameters.

Having the method ID prefixed to the Java method would help to
distinguish them. However, there is still the problem that the command
number must be passed to the different methods, with is ugly.

I know, I am raping the REST style, but which alternatives do I have?
I tried to define each of the web service methods as separate resources,
but SoapUI fails, as all resources share the same path.
Then I tried to append ?command=X to the path, so that it becomes
unique. But then SoapUI appends all method parameters with an additional
?. And I can imagine that wadl2java might fail here, too.

Do you have any ideas?

Kind regards, Sebastian

Am 6/9/2010 8:55 PM, schrieb Andrew Glowik:
> Are you using URI template?
> -ANdrew G.
>
> On Wed, Jun 9, 2010 at 2:27 PM, Hadley, Marc J <mhadley_at_mitre.org
> <mailto:mhadley_at_mitre.org>> wrote:
>
> >our WADL defines multiple GET methods for the same resource, all with
> >mediaType application/xml. The generated code then contains multiple
> >methods with name getAsApplicationXml.
> >Is there a way to work around it?
> >I thought of a switch that changes the naming behavior where the
> method
> >id is used as a prefix.
> >
> A switch could work. However, I'm puzzled why you have multiple
> GET methods in your WADL that all return the same media type -
> presumably there must be some kind of difference between them ?
>
> Marc.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_wadl.dev.java.net
> <mailto:users-unsubscribe_at_wadl.dev.java.net>
> For additional commands, e-mail: users-help_at_wadl.dev.java.net
> <mailto:users-help_at_wadl.dev.java.net>
>
>
>
>
> --
> Andrew Glowik
> Berico Technologies
> 410-872-1365