Hey, ok so a noobie question here. I'm trying to use the 'http-agent' function to make HTTP calls. I can do so easily as in fig. 1. But when I try to make a PUT call as in fig. 2, I get a pretty ugly stacktrace, the bottom one having the error "Caused by: java.lang.IllegalArgumentException: No method in multimethod 'send-request-entity' for dispatch value: class clojure.lang.PersistentStructMap" (fig. 3).
I figure I'm doing something dumb here but can't figure out what... 1) I've tried adding a no-op handler function (fn [agnt] ) to see if the error goes away - nope. 2) I tried adding the example handler function that writes the response directly to dis - no dice :handler (fn [agnt] (with-open [w (clojure.contrib.io/writer"/tmp/out")] ( clojure.contrib.io/copy (clojure.contrib.http.agent/stream agnt) w))) Is there anything obvious I'm missing here? Thanks ===== (require 'clojure.contrib.http.agent) (let [thing (clojure.contrib.http.agent/result (clojure.contrib.http.agent/http-agent "http://google.com" :method "GET" ) )] (. System/out println thing) ) fig. 1 ===== (use 'clojure.xml) ;; use XML library (def myXML (parse "<some_xml>")) ;; load XML from file (require 'clojure.contrib.http.agent) ;; use HTTP client library (require 'clojure.contrib.io) ;; connect to a eXist server ; push the XML object out (clojure.contrib.http.agent/result (clojure.contrib.http.agent/http-agent "http://<some_local_REST_put-address>" :method "PUT" :header {"Content-Type" "text/xml"} :body myXML) ) fig. 2 ===== Caused by: java.lang.Exception: Agent has errors at clojure.lang.Agent.deref(Agent.java:129) ... at clojure.lang.Agent$Action.run(Agent.java:106) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) at java.lang.Thread.run(Thread.java:613) Caused by: java.lang.IllegalArgumentException: No method in multimethod 'send-request-entity' for dispatch value: class clojure.lang.PersistentStructMap at clojure.lang.MultiFn.getFn(MultiFn.java:115) at clojure.lang.MultiFn.invoke(MultiFn.java:161) at clojure.contrib.http.connection$start_http_connection__511.invoke(connection.clj:58) at clojure.contrib.http.agent$start_request__526.invoke(agent.clj:92) at clojure.lang.AFn.applyToHelper(AFn.java:175) ... 6 more fig. 3 -- 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