Handcrafting soap request

Discussion of Common Lisp
Post Reply
mfain
Posts: 1
Joined: Wed Apr 04, 2012 2:26 am

Handcrafting soap request

Post by mfain » Tue Apr 24, 2012 12:01 pm

I've tried to use cl-soap, but the soap request needs namespace in every field, so I tried cxml and drakma.
This is my toy example and I'm sure I'm doing a newbie mistake. Here goes:
;; http://soamoa.org:9292/artistRegistry?wsdl

(defun soamoa-getall (pagesize pagenumber)
(cxml:with-xml-output (cxml:make-character-stream-sink *standard-output* :indentation 2 :canonical nil)
(cxml:with-element "soapenv:Envelope"
(cxml:attribute "xmlns:soap" "http://schemas.xmlsoap.org/soap/envelope")
(cxml:attribute "xmlns:sam" "http://samples.soamoa.yesso.eu/")
(cxml:with-element "soapenv:Header")
(cxml:with-element "soapenv:Body"
(cxml:with-element "sam:getAll"
(cxml:with-element "pageSize"
(cxml:text pagesize))
(cxml:with-element "pageNumber"
(cxml:text pagenumber)))))))

(let ((content (soamoa-getall "1" "2")))
(drakma:http-request "http://soamoa.org:9292/artistRegistry?WSDL" :method :post :content-length t :content content))


so when I try the let statement in my REPL I get
Don't know how to send content #<SWANK-BACKEND::SLIME-OUTPUT-STREAM {4A78D861}> to server.
Shouldn't I use *standard-output*? I'm sure I'm doing some trivial error but I don't see that.
I'm using SBCL and 1.0.49.

Thanks

pjstirling
Posts: 166
Joined: Sun Nov 28, 2010 4:21 pm

Re: Handcrafting soap request

Post by pjstirling » Wed Apr 25, 2012 2:26 am

You want to send a string rather than an output stream :)

CXML:MAKE-STRING-SINK instead of CXML:MAKE-CHARACTER-STREAM-SINK should do the job I think

Post Reply