Re: Re: xmls 0.2 released

Sven Van Caekenberghe <[email protected]>
Newsgroups gmane.lisp.clump
Message-ID <[email protected]>
On Thursday, June 12, 2003, at 09:11 PM, Rudi Schlatte wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Josh Neal <[email protected]> writes:
>
>> On Thu, Jun 12, 2003 at 01:39:08PM -0400, Erik Enge wrote:
>>> Miles Egan <[email protected]> writes:
>>>
>>>> Out of curiousity, do people have more need of an xml-rpc library
>>>> or a soap library?
>>>
>>> Don't know about others but for me: XML-RPC.
>>
>> Same here: we're actively using xml-rpc with Python, and it'd be
>> nice to integrate Lisp with those tools.
>>
>
> I'm 3/4 towards finishing integrating Sven van Caekenburghe's xml-rpc
> library in Portable AllegroServe, and I'll have to demo something
> running on it within 3 weeks.  So, an xml-rpc library will probably
> turn up in paserve/contrib within a month or so.
>

Rudi,

Nice to hear someone is picking this up!

What exactly to you mean by integrating ? I already did some aserve 
integration: from the file aserve.lisp in my xml-rpc distribution:

;;;; -*- mode: lisp -*-
;;;;
;;;; $Id: aserve.lisp,v 1.5 2003/03/10 16:04:22 sven Exp $
;;;;
;;;; This file implements XML-RPC client and server networking based
;;;; on (Portable) AllegroServe (see http://opensource.franz.com/aserve/
;;;; or http://sourceforge.net/projects/portableaserve/), which you have
;;;; to install first.
;;;;
;;;; Copyright (C) 2002, 2003 Sven Van Caekenberghe.
;;;;
;;;; You are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser GNU Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the 
LLGPL.

(require "XML-RPC")

(defpackage xml-rpc-aserve
   (:use common-lisp net.aserve.client net.aserve)
   (:export
    "XML-RPC-CALL"
    "START-XML-RPC-ASERVE"
    "PUBLISH-ASERVE-XML-RPC-HANDLER"))

(in-package :xml-rpc-aserve)

(defun xml-rpc-call-aserve (encoded &key
				    (url *xml-rpc-url*)
				    (agent *xml-rpc-agent*)
				    (host *xml-rpc-host*)
				    (port *xml-rpc-port*)
				    (proxy))
   (let ((xml (print-xml-string encoded)))
     (multiple-value-bind (response response-code headers uri)
	(do-http-request
	 (format nil "http://~a:~d~a" host port url)
	 :method :post
	 :protocol :http/1.0
	 :user-agent agent
	 :content-type "text/xml"
	 :content xml
	 :proxy proxy)
       (declare (ignore headers uri))
       (if (= response-code 200)
	  (decode-xml-rpc-result (parse-xml-string response))
	(error "http-error:~d" response-code)))))

(defun start-xml-rpc-aserve (&key (port *xml-rpc-port*))
   (process-run-function "aserve-xml-rpc"
			#'(lambda ()
			    (start :port port
				   :listeners 4
				   :chunking nil
				   :keep-alive nil))))

(defun publish-aserve-xml-rpc-handler (&key (url *xml-rpc-url*) (agent 
*xml-rpc-agent*))
   (declare (ignore agent))
   (publish :path url
	   :content-type "text/xml"
	   :function #'aserve-xml-rpc-handler))

(defun aserve-xml-rpc-handler (request entity)
   (with-http-response (request
		       entity
		       :response (if (eq :post (request-method request))
				     *response-ok*
				   *response-bad-request*))
     (with-http-body (request entity)
       (let ((body (get-request-body request))
	    (id (process-name *current-process*)))
	(with-input-from-string (in body)
	  (let ((xml (handle-xml-rpc-call in id)))
	    (format-debug t "~d sending ~a~%" id xml)
	    (princ xml *html-stream*)))))))

;;;; eof
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.