Ok after two days I manage to write framework for publishing and
calling webservices (yesterday I asked you for such framework but only
RESTful are available). Right now this implementation supports only
primitve types and was tested in Java distributed environment (needs
to extend to arrays, maps,sets and complex types and also test with
C#).

Here is a snippet of usage code:

server.clj


(ns bpml.server
        (:use [bpml ws]))



; publish web service with implementing methods
(provide-ws "com.jaaka.michael" "Sales" "http://localhost:8283/";

        (String sayHello [ String name String b ]
                (str "Hello " name))

        (Integer addNumbers [ Integer a Integer b ]
                (+ a b))

        (void doSomething[ String dom ]
                (println dom))

)


and client.clj



(ns bpml.client
        (:use [bpml ws]))




; generate client stub
(generate-ws-client-stub "http://localhost:8283/sales?wsdl";)

; first compact way but assumes Service and Port
(let [ c (get-jax-ws-client "com.jaaka.michael" "Sales") ]
        (println "sum is" (.addNumbers c 2 31))
        (.doSomething c "this rox"))


; explicite call of generated stub
(let [ c (.getSalesPort (get-ws-client-stub "com.jaaka.michael"
"SalesService")) ]
        (.addNumbers c 2 10))



under the cover we have newest jax-ws so it is possible to implement
in future rest of ws technologies (transactions, security, attachments
and so on).

The idea is simple. Generate java class with proper annotations,
compile, publish, now for client, fetch the wsdl, generate the client
stub with wsimport, call the desired method, and backing to server,
invoke clojure code returning its results back to the client. All is
dynamic and easy in use as for REPL befits.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to