/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2001
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

interface nsIDOMElement;
interface nsISOAPService;
interface nsISOAPEncodingRegistry;

/**
 * This interface represents a registry of SOAP services.
 * This registry receives transports to listen for messages
 *   and services to hand the messages to.  Service registries
 *   may be created as required.  Destroying a service registry
 *   stops the registry's action.  To temporarily register
 *   services, create a new registry.  For proper order of
 *   listening precedence, registries should be destroyed
 *   in reverse order.  Otherwise, a listening priority
 *   would be required.
 */
[scriptable, uuid(9790d6bc-1dd1-11b2-afe0-bcb310c078bf)]
interface nsISOAPServiceRegistry {
  /**
   * Process a configuration and add the resulting sources
   *   and services.  This will fail if errors occur during
   *   processing of the configuration.
   *
   * @param aConfiguration Root element of configuration XML.
   */
  boolean addConfiguration(in nsIDOMElement aConfiguration);

  /**
   * Add a transport to be serviced by the registered services.
   *   This will fail if the specified source was already added
   *   with the same setting of the capture flag.
   *
   * @param aTransport string specifying the transport to supply
   *   messages for the service.
   *
   * @param aCapture True if capturing before later declarations
   */
  void addSource(in AString aTransport, in boolean aCapture);

  /**
   * Add a service to service the registered transports.  This
   *   will fail if the specified service was already added.
   *
   * @param aService Service to be serviced.
   */
  void addService(in nsISOAPService aService);

  /**
   * Registry identifying how to encode and decode
   *   messages containing specific types, automatically
   *   added to messages sent to services in this
   *   registry.
   */
  attribute nsISOAPEncodingRegistry encodings;
};

%{C++
#define NS_SOAPSERVICEREGISTRY_CID                            \
{ /* 3869184e-1dd2-11b2-aa36-d8333498043a */        \
  0x3869184e, 0x1dd2, 0x11b2,                       \
 {0xaa, 0x36, 0xd8, 0x33, 0x34, 0x98, 0x04, 0x3a} }
#define NS_SOAPSERVICEREGISTRY_CONTRACTID \
"@mozilla.org/xmlextras/soap/serviceregistry;1"
#define NS_SOAPDEFAULTSERVICEREGISTRY_CID                            \
{ /* 9120a01e-1dd2-11b2-a61f-906766927a4f */        \
  0x9120a01e, 0x1dd2, 0x11b2,                       \
 {0xa6, 0x1f, 0x90, 0x67, 0x66, 0x92, 0x7a, 0x4f} }
#define NS_SOAPDEFAULTSERVICEREGISTRY_CONTRACTID \
"@mozilla.org/xmlextras/soap/defaultserviceregistry;1"
%}
