Reputation: 6688
I want to do a POST request to a web service in grails, but it seems like the available JAVA solutions are on a very low abstraction level, like building the POST request myself (here is the sample I found: http://www.exampledepot.com/egs/java.net/Post.html)
Is there a better solution for this problem in Grails? I searched through the manuals and other stuff, but did not really find something. Just wondering, because normally I did not see much code like this wen developing Grails.
So if there is no other solution, then this will also be O.K., abstracted by me and hidden somewhere in our libraries, but I guess there is a better solution somewhere.
Upvotes: 5
Views: 2131
Reputation: 41247
There's the Groovy-specific HTTPBuilder, which provides a nice interface built on the Apache HTTPClient. It even has a REST client, if that's appropriate for the service your are trying to access. There's even a Grails plugin to wrap that all up for you.
If the service is REST-enabled there are a range of Java projects and APIs that can simplify things.
On the other hand, if the web service you are trying to access is SOAP-based, you can leverage GroovyWS, which is also wrapped in a Grails plugin available here.
I've just listed a bunch of options. What will work best depends a lot on the service you are trying to connect to. I'd recommend starting with a pre-built Grails plugin and only branching out if you find it doesn't meet your needs.
Upvotes: 8
Reputation: 1673
there is a web service testing tool called http://www.soapui.org/. the requests are built based on the wsdl. you can simple update the created requests for you need. furthermore the tool is available as a free edition.
Upvotes: 0