Posted by haroldcarr
on March 27, 2009 at 1:23 PM PDT
I show how to use the JVM-based Clojure language to call a Metro-based web service.
Here's how to call a
web service from
- Create and deploy a web service called "Test" with one "hello"
method that takes and echoes a string (follow section 7 in the
Metro Users Guide
for creating a web service using
or follow section 14 for using Ant.) Just create
a vanilla service (i.e., no RM, Security, etc).
- This example assumes the service is deployed at
to create the client side proxy:
$JAVA_HOME/bin/wsimport -keep -p generated.test http://localhost:8080/Test/TestService?wsdl
- Put the location of
generated.text in your classpath
when starting up clojure.
- Start up clojure and enter this function definition
after its prompt
user> (defn hello [x]
(let [service (generated.test.TestService.)
port (. service getTestPort)]
(. port hello x)))
- Then call it
user> (hello "world")
"from SERVICE: world"
That's it! Enjoy
ps: What's the purpose of Lots of Insipid Stupid Parenthesis?