new class to make it easier to build SOAP messages.
authorRodrigo Moya <rodrigo@ximian.com>
Mon, 17 Nov 2003 19:36:33 +0000 (19:36 +0000)
committerRodrigo Moya <rodrigo@src.gnome.org>
Mon, 17 Nov 2003 19:36:33 +0000 (19:36 +0000)
2003-11-17  Rodrigo Moya <rodrigo@ximian.com>

* libsoup/soup-soap-message.[ch]: new class to make it easier to
build SOAP messages.

* libsoup/Makefile.am: added new files.

* configure.in: increased version number.

ChangeLog
configure.in
libsoup/Makefile.am
libsoup/soup-soap-message.c [new file with mode: 0644]
libsoup/soup-soap-message.h [new file with mode: 0644]

index f1a4857..9d3dcde 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-11-17  Rodrigo Moya <rodrigo@ximian.com>
+
+       * libsoup/soup-soap-message.[ch]: new class to make it easier to
+       build SOAP messages.
+
+       * libsoup/Makefile.am: added new files.
+
+       * configure.in: increased version number.
+
 2003-10-24  Joe Shaw  <joe@ximian.com>
 
        * libsoup/soup-address.c (update_address_from_entry): Call
index 8d01009..0cd8537 100644 (file)
@@ -3,7 +3,7 @@ dnl *** Initialize automake and set version ***
 dnl *******************************************
 
 AC_PREREQ(2.53)
-AC_INIT(libsoup, 2.1.0)
+AC_INIT(libsoup, 2.1.1)
 AC_CONFIG_SRCDIR(libsoup-2.2.pc.in)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 
index 735047f..9a8e08e 100644 (file)
@@ -39,6 +39,7 @@ libsoupinclude_HEADERS =      \
        soup-server-message.h   \
        soup-server.h           \
        soup-session.h          \
+       soup-soap-message.h     \
        soup-socket.h           \
        soup-status.h           \
        soup-types.h            \
@@ -85,6 +86,7 @@ libsoup_2_2_la_SOURCES =              \
        soup-server-auth.c              \
        soup-server-message.c           \
        soup-session.c                  \
+       soup-soap-message.c             \
        soup-socket.c                   \
        soup-ssl.h                      \
        soup-status.c                   \
diff --git a/libsoup/soup-soap-message.c b/libsoup/soup-soap-message.c
new file mode 100644 (file)
index 0000000..c803d5b
--- /dev/null
@@ -0,0 +1,95 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003, Novell, Inc.
+ */
+
+#include "soup-soap-message.h"
+#include "soup-uri.h"
+
+#define PARENT_TYPE SOUP_TYPE_MESSAGE
+
+struct _SoupSoapMessagePrivate {
+};
+
+static GObjectClass *parent_class = NULL;
+
+static void
+finalize (GObject *object)
+{
+       SoupSoapMessage *msg = SOUP_SOAP_MESSAGE (object);
+
+       /* free memory */
+       g_free (msg->priv);
+       msg->priv = NULL;
+
+       parent_class->finalize (object);
+}
+
+static void
+class_init (SoupSoapMessageClass *klass)
+{
+       GObjectClass *object_class;
+
+       parent_class = g_type_class_peek_parent (klass);
+
+       object_class = G_OBJECT_CLASS (klass);
+       object_class->finalize = finalize;
+}
+
+static void
+init (SoupSoapMessage *msg, SoupSoapMessageClass *klass)
+{
+       msg->priv = g_new0 (SoupSoapMessagePrivate, 1);
+}
+
+SOUP_MAKE_TYPE (soup_soap_message, SoupSoapMessage, class_init, init, PARENT_TYPE)
+
+/**
+ * soup_soap_message_new:
+ * @method: the HTTP method for the created request.
+ * @uri_string: the destination endpoint (as a string).
+ *
+ * Creates a new empty #SoupSoapMessage, which will connect to @uri_string.
+ *
+ * Returns: the new #SoupSoapMessage (or %NULL if @uri_string could not be
+ * parsed).
+ */
+SoupSoapMessage *
+soup_soap_message_new (const char *method, const char *uri_string)
+{
+       SoupSoapMessage *msg;
+       SoupUri *uri;
+
+       uri = soup_uri_new (uri_string);
+       if (!uri)
+               return NULL;
+
+       msg = g_object_new (SOUP_TYPE_SOAP_MESSAGE, NULL);
+       SOUP_MESSAGE (msg)->method = method ? method : SOUP_METHOD_GET;
+       soup_message_set_uri (SOUP_MESSAGE (msg), (const SoupUri *) uri);
+
+       soup_uri_free (uri);
+
+       return msg;
+}
+
+/**
+ * soup_soap_message_new_from_uri:
+ * @method: the HTTP method for the created request.
+ * @uri: the destination endpoint (as a #SoupUri).
+ *
+ * * Creates a new empty #SoupSoapMessage, which will connect to @uri
+ *
+ * Returns: the new #SoupSoapMessage
+ */
+SoupSoapMessage *
+soup_soap_message_new_from_uri (const char *method, const SoupUri *uri)
+{
+       SoupSoapMessage *msg;
+
+       msg = g_object_new (SOUP_TYPE_SOAP_MESSAGE, NULL);
+       SOUP_MESSAGE (msg)->method = method ? method : SOUP_METHOD_GET;
+       soup_message_set_uri (SOUP_MESSAGE (msg), uri);
+
+       return msg;
+}
diff --git a/libsoup/soup-soap-message.h b/libsoup/soup-soap-message.h
new file mode 100644 (file)
index 0000000..f14ea72
--- /dev/null
@@ -0,0 +1,34 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2003, Novell, Inc.
+ */
+
+#ifndef SOUP_SOAP_MESSAGE_H
+#define SOUP_SOAP_MESSAGE_H 1
+
+#include <libsoup/soup-message.h>
+
+#define SOUP_TYPE_SOAP_MESSAGE            (soup_soap_message_get_type ())
+#define SOUP_SOAP_MESSAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SOAP_MESSAGE, SoupSoapMessage))
+#define SOUP_SOAP_MESSAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SOAP_MESSAGE, SoupSoapMessageClass))
+#define SOUP_IS_SOAP_MESSAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SOAP_MESSAGE))
+#define SOUP_IS_SOAP_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SOAP_MESSAGE))
+#define SOUP_SOAP_MESSAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SOAP_MESSAGE, SoupSoapMessageClass))
+
+typedef struct _SoupSoapMessagePrivate SoupSoapMessagePrivate;
+
+typedef struct {
+       SoupMessage parent;
+       SoupSoapMessagePrivate *priv;
+} SoupSoapMessage;
+
+typedef struct {
+       SoupMessageClass parent_class;
+} SoupSoapMessageClass;
+
+GType            soup_soap_message_get_type (void);
+
+SoupSoapMessage *soup_soap_message_new (const char *method, const char *uri_string);
+SoupSoapMessage *soup_soap_message_new_from_uri (const char *method, const SoupUri *uri);
+
+#endif