Re: Demo Code/Documentation?

Dan Winship <[email protected]> 26 Sep 2002 09:50:19 -0400
Newsgroups gmane.comp.gnome.ximian.soup
Message-ID <[email protected]>
On Wed, 2002-09-25 at 21:17, Matthew Bogosian wrote:
> Sorry to bug everyone, but is there any documentation/demo code giving a
> little more info on how to use libsoup.so in ones own WS
> clients/servers? I haven't been able to find any.

I don't know if there any good examples of using the SOAP functionality
around, but Evolution uses it for plain HTTP. Eg:

gboolean
e_summary_rdf_update (ESummary *summary)
{
	GList *r;

	for (r = summary->rdf->rdfs; r; r = r->next) {
		SoupContext *context;
		RDF *rdf = r->data;

		if (rdf->message) {
			continue;
		}

		context = soup_context_get (rdf->uri);
		if (context == NULL) {
			g_warning ("Invalid URL: %s", rdf->uri);
			continue;
		}

		rdf->message = soup_message_new (context, SOUP_METHOD_GET);
		soup_context_unref (context);
		soup_message_queue (rdf->message, message_finished, rdf);
	}

	return TRUE;
}

static void
message_finished (SoupMessage *msg,
		  gpointer userdata)
{
	xmlDocPtr doc;
	RDF *r = (RDF *) userdata;

	if (SOUP_MESSAGE_IS_ERROR (msg)) {
		g_warning ("Message failed: %d\n%s", msg->errorcode,
			   msg->errorphrase);
		r->message = NULL;

		display_doc (r);
		return;
	}

	doc = xmlParseMemory (msg->response.body, msg->response.length);
	r->cache = doc;
	r->message = NULL;

	/* Display it */
	display_doc (r);
}




_______________________________________________
Soup-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/soup-list