summaryrefslogtreecommitdiffstats
path: root/libcsoap
diff options
context:
space:
mode:
authorGravatar m0gg2006-11-21 08:34:34 +0000
committerGravatar m0gg2006-11-21 08:34:34 +0000
commitcd94b25993049a596b163f0ad8b3a2340e024cc3 (patch)
tree0b9489cf8c5869a2015bc6b1549e1f08f35325e9 /libcsoap
parent949a8d0b46d6baa9f42c2f8c3bd5e3bdc3596cbd (diff)
downloadcsoap-cd94b25993049a596b163f0ad8b3a2340e024cc3.tar.gz
csoap-cd94b25993049a596b163f0ad8b3a2340e024cc3.tar.bz2
Web Services Addressing for multiple transport daemons (initial)
Diffstat (limited to 'libcsoap')
-rw-r--r--libcsoap/Makefile.am4
-rw-r--r--libcsoap/soap-addressing.c527
-rw-r--r--libcsoap/soap-addressing.h236
-rw-r--r--libcsoap/soap-env.c3
-rw-r--r--libcsoap/soap-env.h4
-rw-r--r--libcsoap/soap-server.c18
-rw-r--r--libcsoap/soap-xml.h3
7 files changed, 780 insertions, 15 deletions
diff --git a/libcsoap/Makefile.am b/libcsoap/Makefile.am
index 8b096d4..ecd212a 100644
--- a/libcsoap/Makefile.am
+++ b/libcsoap/Makefile.am
@@ -5,11 +5,11 @@ libcsoap_ladir=$(includedir)/libcsoap-@csoap_release@/libcsoap
libcsoap_la_SOURCES=soap-xml.c soap-fault.c soap-env.c soap-service.c \
soap-router.c soap-client.c soap-server.c soap-ctx.c \
- soap-admin.c
+ soap-admin.c soap-addressing.c
libcsoap_la_HEADERS=soap-xml.h soap-fault.h soap-env.h soap-service.h \
soap-router.h soap-client.h soap-server.h soap-ctx.h \
- soap-admin.h
+ soap-admin.h soap-addressing.h
libcsoap_la_LDFLAGS= -version-info @csoap_version@ -release @csoap_release@
libcsoap_la_CFLAGS=-I${top_srcdir}
diff --git a/libcsoap/soap-addressing.c b/libcsoap/soap-addressing.c
new file mode 100644
index 0000000..bd542fd
--- /dev/null
+++ b/libcsoap/soap-addressing.c
@@ -0,0 +1,527 @@
+/******************************************************************
+* $Id: soap-addressing.c,v 1.1 2006/11/21 08:34:34 m0gg Exp $
+*
+* CSOAP Project: A SOAP client/server library in C
+* Copyright (C) 2006 Heiko Ronsdorf
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Library General Public
+* License as published by the Free Software Foundation; either
+* version 2 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Library General Public License for more details.
+*
+* You should have received a copy of the GNU Library General Public
+* License along with this library; if not, write to the
+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+* Boston, MA 02111-1307, USA.
+*
+* Email: hero@persua.de
+******************************************************************/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_UUID_H
+#include <uuid.h>
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/uri.h>
+
+#include <nanohttp/nanohttp-common.h>
+#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
+#include <nanohttp/nanohttp-logging.h>
+
+#include "soap-xml.h"
+#include "soap-env.h"
+#include "soap-addressing.h"
+
+static const char *_soap_addressing_uuid_error(uint32_t status)
+{
+ switch(status)
+ {
+ case uuid_s_bad_version:
+ return "The UUID does not have a known version";
+ case uuid_s_invalid_string_uuid:
+ return "The string representation of an UUID is not valid";
+ case uuid_s_no_memory:
+ /* XXX: From FreeBSD 6.2 UUID(3) ??? */
+ return "The meaning of the code escaped the writers mind";
+ default:
+ return "Unkown error";
+ }
+}
+
+static char * _soap_addressing_generate_id(void)
+{
+ uuid_t uuid;
+ uint32_t status;
+ char *ret;
+
+ uuid_create(&uuid, &status);
+ if (status != uuid_s_ok)
+ {
+ log_error2("uuidcreate failed (%s)", _soap_addressing_uuid_error(status));
+ return NULL;
+ }
+
+ uuid_to_string(&uuid, &ret, &status);
+ if (status != uuid_s_ok)
+ {
+ log_error2("uuid_to_string failed (%s)", _soap_addressing_uuid_error(status));
+ return NULL;
+ }
+ return ret;
+}
+
+static xmlNsPtr _soap_addressing_get_namespace(xmlNodePtr node)
+{
+ xmlNsPtr ns;
+
+ if (!(ns = xmlSearchNsByHref(node->doc, node, BAD_CAST WSA_NAMESPACE)))
+ {
+ ns = xmlNewNs(node, BAD_CAST WSA_NAMESPACE, BAD_CAST WSA_NAMESPACE_PREFIX);
+ }
+ return ns;
+}
+
+static xmlNodePtr _soap_addressing_add_node(xmlNodePtr parent, const xmlChar *name, const xmlChar *content)
+{
+ xmlNsPtr ns;
+
+ ns = _soap_addressing_get_namespace(parent);
+ return xmlNewChild(parent, ns, name, content);
+}
+
+static xmlAttrPtr _soap_addressing_set_property(xmlNodePtr node, const xmlChar *name, const xmlChar *value)
+{
+ xmlNsPtr ns;
+
+ ns = _soap_addressing_get_namespace(node);
+ return xmlSetNsProp(node, ns, name, value);
+}
+
+static xmlAttrPtr _soap_addressing_set_property_uri(xmlNodePtr node, const xmlChar *name, xmlURI *uri)
+{
+ xmlChar *buf;
+ xmlAttrPtr ret;
+
+ buf = xmlSaveUri(uri);
+ ret = _soap_addressing_set_property(node, name, buf);
+ xmlFree(buf);
+
+ return ret;
+}
+
+static xmlNodePtr _soap_addressing_get_child_element(xmlNodePtr parent, const xmlChar *name)
+{
+ xmlNodePtr walker;
+
+ for (walker = soap_xml_get_children(parent); walker; walker = soap_xml_get_next(walker))
+ {
+ if (!xmlStrcmp(walker->name, name) && !xmlStrcmp(walker->ns->href, WSA_NAMESPACE))
+ return walker;
+ }
+ return NULL;
+}
+
+static xmlURI *_soap_addressing_extract_uri(xmlNodePtr node)
+{
+ xmlChar *content;
+ xmlURI *uri = NULL;
+
+ if ((content = xmlNodeGetContent(node)))
+ {
+ uri = xmlParseURI(content);
+ xmlFree(content);
+ }
+ return uri;
+}
+
+static xmlNodePtr _soap_addressing_set_content_uri(xmlNodePtr node, xmlURI *uri)
+{
+ xmlChar *buf;
+
+ buf = xmlSaveUri(uri);
+ xmlNodeSetContent(node, buf);
+ xmlFree(buf);
+
+ return node;
+}
+
+xmlURI *soap_addressing_get_address(xmlNodePtr endpoint_reference)
+{
+ xmlNodePtr address;
+
+ address = _soap_addressing_get_child_element(endpoint_reference, WSA_ADDRESS);
+ if (address == NULL)
+ return NULL;
+
+ return _soap_addressing_extract_uri(address);
+}
+
+xmlNodePtr soap_addressing_set_address(xmlNodePtr endpoint_reference, xmlURI *address)
+{
+ xmlNodePtr node;
+
+ node = _soap_addressing_get_child_element(endpoint_reference, WSA_ADDRESS);
+ if (node == NULL)
+ node = _soap_addressing_add_node(endpoint_reference, WSA_ADDRESS, NULL);
+
+ return _soap_addressing_set_content_uri(node, address);
+}
+
+xmlNodePtr soap_addressing_get_reference_properties(xmlNodePtr endpoint_reference)
+{
+ return _soap_addressing_get_child_element(endpoint_reference, WSA_REFERENCE_PROPERTIES);
+}
+
+xmlNodePtr soap_addressing_set_reference_properties(xmlNodePtr endpoint_reference, xmlNodePtr properties)
+{
+ xmlNodePtr node;
+
+ node = soap_addressing_get_reference_properties(endpoint_reference);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ node = xmlCopyNode(properties, 1);
+ xmlUnlinkNode(node);
+ xmlAddChild(endpoint_reference, node);
+
+ return node;
+}
+
+xmlNodePtr soap_addressing_get_metadata(xmlNodePtr endpoint_reference)
+{
+ return _soap_addressing_get_child_element(endpoint_reference, WSA_METADATA);
+}
+
+xmlNodePtr soap_addressing_set_metadata(xmlNodePtr endpoint_reference, xmlNodePtr metadata)
+{
+ xmlNodePtr node;
+
+ node = soap_addressing_get_metadata(endpoint_reference);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ node = xmlCopyNode(metadata, 1);
+ xmlUnlinkNode(node);
+ xmlAddChild(endpoint_reference, node);
+
+ return node;
+}
+
+xmlURI *soap_addressing_get_message_id(SoapEnv *envelope)
+{
+ xmlNodePtr id;
+
+ id = _soap_addressing_get_child_element(envelope->header, WSA_MESSAGE_ID);
+ if (id == NULL)
+ return NULL;
+
+ return _soap_addressing_extract_uri(id);
+}
+
+xmlNodePtr soap_addressing_set_message_id(SoapEnv *envelope, xmlURI *id)
+{
+ xmlNodePtr node;
+
+ node = _soap_addressing_get_child_element(envelope->header, WSA_MESSAGE_ID);
+ if (node == NULL)
+ node = _soap_addressing_add_node(envelope->header, WSA_MESSAGE_ID, NULL);
+
+ return _soap_addressing_set_content_uri(node, id);
+}
+
+xmlNodePtr soap_addressing_get_relates_to(SoapEnv *envelope)
+{
+ return _soap_addressing_get_child_element(envelope->header, WSA_RELATES_TO);
+}
+
+xmlNodePtr soap_addressing_add_relates_to(SoapEnv *envelope, xmlURI *id, xmlURI *type)
+{
+ xmlNodePtr node;
+
+ node = soap_addressing_get_relates_to(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ node = _soap_addressing_add_node(envelope->header, WSA_RELATES_TO, NULL);
+ _soap_addressing_set_content_uri(node, id);
+ _soap_addressing_set_property_uri(node, WSA_RELATIONSHIP_TYPE, type);
+
+ return node;
+}
+
+xmlNodePtr soap_addressing_get_reply_to(SoapEnv *envelope)
+{
+ return _soap_addressing_get_child_element(envelope->header, WSA_REPLY_TO);
+}
+
+xmlNodePtr soap_addressing_set_reply_to(SoapEnv *envelope, xmlNodePtr address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_reply_to(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_REPLY_TO, NULL);
+ node = xmlCopyNode(address, 1);
+ xmlUnlinkNode(node);
+ xmlAddChild(ret, node);
+
+ return ret;
+}
+
+xmlURI *soap_addressing_get_reply_to_address(SoapEnv *envelope)
+{
+ xmlNodePtr reply_to;
+
+ reply_to = soap_addressing_get_reply_to(envelope);
+ if (reply_to == NULL)
+ return NULL;
+
+ return soap_addressing_get_address(reply_to);
+}
+
+xmlNodePtr soap_addressing_set_reply_to_address(SoapEnv *envelope, xmlURI *address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_reply_to(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_REPLY_TO, NULL);
+ soap_addressing_set_address(ret, address);
+
+ return ret;
+}
+
+xmlNodePtr soap_addressing_get_from(SoapEnv *envelope)
+{
+ return _soap_addressing_get_child_element(envelope->header, WSA_FROM);
+}
+
+xmlNodePtr soap_addressing_set_from(SoapEnv *envelope, xmlNodePtr address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_from(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_FROM, NULL);
+ node = xmlCopyNode(address, 1);
+ xmlUnlinkNode(node);
+ xmlAddChild(ret, node);
+
+ return ret;
+}
+
+xmlURI *soap_addressing_get_from_address(SoapEnv *envelope)
+{
+ xmlNodePtr from;
+
+ from = soap_addressing_get_from(envelope);
+ if (from == NULL)
+ return NULL;
+
+ return soap_addressing_get_address(from);
+}
+
+xmlNodePtr soap_addressing_set_from_address(SoapEnv *envelope, xmlURI *address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_from(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_FROM, NULL);
+ soap_addressing_set_address(ret, address);
+
+ return ret;
+}
+
+xmlNodePtr soap_addressing_get_fault_to(SoapEnv *envelope)
+{
+ return _soap_addressing_get_child_element(envelope->header, WSA_FAULT_TO);
+}
+
+xmlNodePtr soap_addressing_set_fault_to(SoapEnv *envelope, xmlNodePtr address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_fault_to(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_FAULT_TO, NULL);
+ node = xmlCopyNode(address, 1);
+ xmlUnlinkNode(node);
+ xmlAddChild(ret, node);
+
+ return ret;
+}
+
+xmlURI *soap_addressing_get_fault_to_address(SoapEnv *envelope)
+{
+ xmlNodePtr fault_to;
+
+ fault_to = soap_addressing_get_fault_to(envelope);
+ if (fault_to == NULL)
+ return NULL;
+
+ return soap_addressing_get_address(fault_to);
+}
+
+xmlNodePtr soap_addressing_set_fault_to_address(SoapEnv *envelope, xmlURI *address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_fault_to(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_FAULT_TO, NULL);
+ soap_addressing_set_address(ret, address);
+
+ return ret;
+}
+
+xmlNodePtr soap_addressing_get_to(SoapEnv *envelope)
+{
+ return _soap_addressing_get_child_element(envelope->header, WSA_TO);
+}
+
+xmlNodePtr soap_addressing_set_to(SoapEnv *envelope, xmlNodePtr address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_to(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_TO, NULL);
+ node = xmlCopyNode(address, 1);
+ xmlUnlinkNode(node);
+ xmlAddChild(ret, node);
+
+ return ret;
+}
+
+xmlURI *soap_addressing_get_to_address(SoapEnv *envelope)
+{
+ xmlNodePtr to;
+
+ to = soap_addressing_get_to(envelope);
+ if (to == NULL)
+ return NULL;
+
+ return soap_addressing_get_address(to);
+}
+
+xmlNodePtr soap_addressing_set_to_address(SoapEnv *envelope, xmlURI *address)
+{
+ xmlNodePtr ret;
+ xmlNodePtr node;
+
+ node = soap_addressing_get_to(envelope);
+ if (node != NULL)
+ {
+ xmlUnlinkNode(node);
+ xmlFreeNode(node);
+ }
+
+ ret = _soap_addressing_add_node(envelope->header, WSA_TO, NULL);
+ soap_addressing_set_address(ret, address);
+
+ return ret;
+}
+
+xmlURI *soap_addressing_get_action(SoapEnv *envelope)
+{
+ xmlNodePtr action;
+
+ action = _soap_addressing_get_child_element(envelope->header, WSA_ACTION);
+ if (action == NULL)
+ return NULL;
+
+ return _soap_addressing_extract_uri(action);
+}
+
+xmlNodePtr soap_addressing_set_action(SoapEnv *envelope, xmlURI *action)
+{
+ xmlNodePtr node;
+
+ node = _soap_addressing_get_child_element(envelope->header, WSA_ACTION);
+ if (node == NULL)
+ node = _soap_addressing_add_node(envelope->header, WSA_ACTION, NULL);
+
+ return _soap_addressing_set_content_uri(node, action);
+}
diff --git a/libcsoap/soap-addressing.h b/libcsoap/soap-addressing.h
new file mode 100644
index 0000000..8ffbd41
--- /dev/null
+++ b/libcsoap/soap-addressing.h
@@ -0,0 +1,236 @@
+/******************************************************************
+ * $Id: soap-addressing.h,v 1.1 2006/11/21 08:34:34 m0gg Exp $
+ *
+ * CSOAP Project: A SOAP client/server library in C
+ * Copyright (C) 2006 Heiko Ronsdorf
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Email: hero@persua.de
+ ******************************************************************/
+#ifndef __csoap_addressing_h
+#define __csoap_addressing_h
+
+/**
+ *
+ * WS-Addressing provides transport-neutral mechanisms to address Web services
+ * and messages. Specifically, this specification defines XML [XML 1.0, XML
+ * Namespaces] elements to identify Web service endpoints and to secure
+ * end-to-end endpoint identification in messages. This specification enables
+ * messaging systems to support message transmission through networks that
+ * include processing nodes such as endpoint managers, firewalls, and gateways
+ * in a transport-neutral manner.
+ *
+ * @author H. Ronsdorf
+ * @version $Revision: 1.1 $
+ * @see http://www.w3.org/TR/ws-addr-core/
+ *
+ */
+#define WSA_NAMESPACE "http://www.w3.org/2005/08/addressing"
+#define WSA_NAMESPACE_PREFIX "wsa"
+
+/**
+ *
+ * Some endpoints cannot be located with a meaningful IRI; this URI is used to
+ * allow such endpoints to send and receive messages. The precise meaning of
+ * this URI is defined by the binding of Addressing to a specific protocol
+ * and/or the context in which the EPR is used.
+ *
+ */
+#define WSA_ANONYMOUS WSA_NAMESPACE "/anonymous"
+
+/**
+ *
+ * Messages sent to EPRs whose [address] is this value MUST be discarded (i.e.
+ * not sent). This URI is typically used in EPRs that designate a reply or fault
+ * endpoint (see section 3.1 Abstract Property Definitions) to indicate that no
+ * reply or fault message should be sent.
+ *
+ */
+#define WSA_NONE WSA_NAMESPACE "/none"
+
+/**
+ *
+ * Indicates that this is a reply to the message identified by the [message id]
+ * IRI.
+ *
+ */
+#define WSA_REPLY WSA_NAMESPACE "/reply"
+
+/**
+ *
+ * The wsa:EndpointReferenceType type is used wherever a Web service endpoint is
+ * referenced.
+ *
+ */
+#define WSA_ENDPOINT_REFERENCE_TYPE "EndpointReferenceType"
+
+/**
+ *
+ * This represents some element of type wsa:EndpointReferenceType. Any element
+ * of type wsa:EndpointReferenceType may be used. There is an extensibility
+ * mechanism to allow additional elements to be specified.
+ *
+ */
+#define WSA_ENDPOINT_REFERENCE "EndpointReference"
+
+/**
+ *
+ * This OPTIONAL element contains the elements that convey the [reference
+ * properties] of the reference. Each child element of ReferenceProperties
+ * represents an individual [reference property].
+ *
+ */
+#define WSA_REFERENCE_PROPERTIES "ReferenceProperties"
+
+/**
+ *
+ * This OPTIONAL element may contain elements from any namespace. Such elements
+ * form the metadata that is relevant to the interaction with the endpoint.
+ *
+ */
+#define WSA_METADATA "Metadata"
+
+/**
+ *
+ * This OPTIONAL element (of type xs:anyURI) conveys the [message id] property.
+ * This element MUST be present if wsa:ReplyTo or wsa:FaultTo is present.
+ *
+ */
+#define WSA_MESSAGE_ID "MessageID"
+
+/**
+ *
+ * This OPTIONAL (repeating) element information item contributes one abstract
+ * [relationship] property value, in the form of a (URI, QName) pair. The
+ * [children] property of this element (which is of type xs:anyURI) conveys the
+ * [message id] of the related message. This element MUST be present if the
+ * message is a reply.
+ *
+ */
+#define WSA_RELATES_TO "RelatesTo"
+
+/**
+ *
+ * This OPTIONAL attribute of <wsa:RelatesTo> (of type xs:QName) conveys the
+ * relationship type as a QName. When absent, the implied value of this attribute
+ * is wsa:Reply.
+ *
+ */
+#define WSA_RELATIONSHIP_TYPE "RelationshipType"
+
+
+/**
+ *
+ * This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value
+ * for the [reply endpoint] property. This element MUST be present if a reply is
+ * expected. If this element is present, wsa:MessageID MUST be present.
+ *
+ */
+#define WSA_REPLY_TO "ReplyTo"
+
+/**
+ *
+ * This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value
+ * for the [source endpoint] property.
+ *
+ */
+#define WSA_FROM "From"
+
+/**
+ *
+ * This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value
+ * for the [fault endpoint] property. If this element is present, wsa:MessageID
+ * MUST be present.
+ *
+ */
+#define WSA_FAULT_TO "FaultTo"
+
+/**
+ *
+ * This REQUIRED element (of type xs:anyURI) provides the value for the
+ * [destination] property.
+ *
+ */
+#define WSA_TO "To"
+
+/**
+ *
+ * This REQUIRED element of type xs:anyURI conveys the [action] property. The
+ * [children] of this element convey the value of this property.
+ *
+ */
+#define WSA_ACTION "Action"
+
+/**
+ *
+ * An address URI that identifies the endpoint. This may be a network address or
+ * a logical address.
+ *
+ */
+#define WSA_ADDRESS "Address"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+xmlURI *soap_addressing_get_address(xmlNodePtr endpoint_reference);
+xmlNodePtr soap_addressing_set_address(xmlNodePtr endpoint_reference, xmlURI *address);
+
+xmlNodePtr soap_addressing_get_reference_properties(xmlNodePtr endpoint_reference);
+xmlNodePtr soap_addressing_set_reference_properties(xmlNodePtr endpoint_reference, xmlNodePtr property);
+
+xmlNodePtr soap_addressing_get_metadata(xmlNodePtr endpoint_reference);
+xmlNodePtr soap_addressing_set_metadata(xmlNodePtr endpoint_reference, xmlNodePtr parameter);
+
+xmlURI *soap_addressing_get_message_id(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_message_id(SoapEnv *envelope, xmlURI *id);
+
+xmlNodePtr soap_addressing_get_relates_to(SoapEnv *envelope);
+xmlNodePtr soap_addressing_add_relates_to(SoapEnv *envelope, xmlURI *id, xmlURI *type);
+
+xmlNodePtr soap_addressing_get_reply_to(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_reply_to(SoapEnv *envelope, xmlNodePtr address);
+
+xmlURI *soap_addressing_get_reply_to_address(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_reply_to_address(SoapEnv *envelope, xmlURI *address);
+
+xmlNodePtr soap_addressing_get_from(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_from(SoapEnv *envelope, xmlNodePtr address);
+
+xmlURI *soap_addressing_get_from_address(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_from_address(SoapEnv *envelope, xmlURI *address);
+
+xmlNodePtr soap_addressing_get_fault_to(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_fault_to(SoapEnv *envelope, xmlNodePtr address);
+
+xmlURI *soap_addressing_get_fault_to_address(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_fault_to_address(SoapEnv *envelope, xmlURI *address);
+
+xmlNodePtr soap_addressing_get_to(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_to(SoapEnv *envelope, xmlNodePtr address);
+
+xmlURI *soap_addressing_get_to_address(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_to_address(SoapEnv *envelope, xmlURI *address);
+
+xmlURI *soap_addressing_get_action(SoapEnv *envelope);
+xmlNodePtr soap_addressing_set_action(SoapEnv *envelope, xmlURI *action);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcsoap/soap-env.c b/libcsoap/soap-env.c
index abff67e..dc64d98 100644
--- a/libcsoap/soap-env.c
+++ b/libcsoap/soap-env.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-env.c,v 1.21 2006/11/19 09:40:14 m0gg Exp $
+* $Id: soap-env.c,v 1.22 2006/11/21 08:34:34 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -59,6 +59,7 @@
#include <nanohttp/nanohttp-common.h>
#include <nanohttp/nanohttp-socket.h>
+#include <nanohttp/nanohttp-stream.h>
#include <nanohttp/nanohttp-logging.h>
#include "soap-xml.h"
diff --git a/libcsoap/soap-env.h b/libcsoap/soap-env.h
index 5440e78..53d8ce5 100644
--- a/libcsoap/soap-env.h
+++ b/libcsoap/soap-env.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-env.h,v 1.14 2006/03/06 13:37:38 m0gg Exp $
+ * $Id: soap-env.h,v 1.15 2006/11/21 08:34:34 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -24,8 +24,6 @@
#ifndef cSOAP_ENV_H
#define cSOAP_ENV_H
-#include <nanohttp/nanohttp-stream.h>
-
#include <libcsoap/soap-xml.h>
#include <libcsoap/soap-fault.h>
diff --git a/libcsoap/soap-server.c b/libcsoap/soap-server.c
index e0297b3..638105f 100644
--- a/libcsoap/soap-server.c
+++ b/libcsoap/soap-server.c
@@ -1,5 +1,5 @@
/******************************************************************
-* $Id: soap-server.c,v 1.27 2006/11/19 09:40:14 m0gg Exp $
+* $Id: soap-server.c,v 1.28 2006/11/21 08:34:34 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -109,10 +109,13 @@ _soap_server_send_fault(httpd_conn_t * conn, const char *errmsg)
if (err != H_OK)
{
log_error1(herror_message(err));
- http_output_stream_write_string(conn->out, "<html><head></head><body>");
- http_output_stream_write_string(conn->out, "<h1>Error</h1><hr/>");
http_output_stream_write_string(conn->out,
- "Error while sending fault object:<br>Message: ");
+ "<html>"
+ "<head></head>"
+ "<body>"
+ "<h1>Error</h1><hr/>"
+ "Error while sending fault object:"
+ "<br />Message: ");
http_output_stream_write_string(conn->out, herror_message(err));
http_output_stream_write_string(conn->out, "<br />Function: ");
http_output_stream_write_string(conn->out, herror_func(err));
@@ -226,8 +229,8 @@ router_node_new(SoapRouter * router, const char *context, SoapRouterNode * next)
const char *noname = "/lost_found";
SoapRouterNode *node;
- if (!(node = (SoapRouterNode *) malloc(sizeof(SoapRouterNode)))) {
-
+ if (!(node = (SoapRouterNode *) malloc(sizeof(SoapRouterNode))))
+ {
log_error2("malloc failed (%s)", strerror(errno));
return NULL;
}
@@ -274,7 +277,6 @@ soap_server_entry(httpd_conn_t * conn, hrequest_t * req)
SoapEnv *env;
herror_t err;
-
if (!(router = soap_server_find_router(req->path)))
{
_soap_server_send_fault(conn, "Cannot find router");
@@ -296,7 +298,7 @@ soap_server_entry(httpd_conn_t * conn, hrequest_t * req)
"<body>"
"<h1>Sorry!</h1>"
"<hr />"
- "<div>I only speak with 'POST' method </div>"
+ "<div>I only speak with 'POST' method.</div>"
"</body>"
"</html>");
return;
diff --git a/libcsoap/soap-xml.h b/libcsoap/soap-xml.h
index ad578b1..801091d 100644
--- a/libcsoap/soap-xml.h
+++ b/libcsoap/soap-xml.h
@@ -1,5 +1,5 @@
/******************************************************************
- * $Id: soap-xml.h,v 1.8 2006/03/06 13:37:38 m0gg Exp $
+ * $Id: soap-xml.h,v 1.9 2006/11/21 08:34:34 m0gg Exp $
*
* CSOAP Project: A SOAP client/server library in C
* Copyright (C) 2003 Ferhat Ayaz
@@ -34,6 +34,7 @@ static const char * const soap_env_enc = "http://schemas.xmlsoap.org/soap/encodi
static const char * const soap_xsi_ns = "http://www.w3.org/1999/XMLSchema-instance";
static const char * const soap_xsd_ns = "http://www.w3.org/1999/XMLSchema";
+
typedef int (*soap_xmlnode_callback) (xmlNodePtr, void *);
#ifdef __cplusplus