⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 esoapserver.cpp

📁 ESOAP一款专注于嵌入式的WEB SERVICE开发的软件。
💻 CPP
字号:
/////////////////////////////////////////////////////////////////////////////
// $Id: esoapserver.cpp,v 1.41 2001/09/11 11:45:53 rosimildo Exp $
//
// Copyright (c) 2001 Exor International Inc. All rights reserved.
//
// MODULE DESCRIPTION: 
// A simple test example to show the usage of the 
// embbeded SOAP toolkit. Server Side.
//
// MODIFICATION/HISTORY:
//
// $Log: esoapserver.cpp,v $
// Revision 1.41  2001/09/11 11:45:53  rosimildo
// changed copyright from Technopoint to Exit; updated version to 0.9
//
// Revision 1.40  2001/07/28 14:02:20  rosimildo
// Added basic auth framework.
//
// Revision 1.39  2001/07/25 17:58:05  rosimildo
// Added the eCos makefiles + some changes to compiler with the
// x86 PC toolset.
//
// Revision 1.38  2001/05/18 13:38:33  rosimildo
// Added new file.
//
// Revision 1.37  2001/05/17 00:41:01  rosimildo
// Some more changes.
//
// Revision 1.36  2001/05/08 20:12:50  rosimildo
// Added support for another Server: apache module
//
//
// Created 2001/02/08 Rosimildo da Silva, ConnectTel Inc.
// [rdasilva@connecttel.com]
//
/////////////////////////////////////////////////////////////////////////////

#include <stdio.h>
#include <assert.h>

#include "soap_server.h"
#include "soap_envelope.h"
#include "syslogpp.h"
#include "soap_version.h"
#ifdef __ECOS
#include <network.h>
#endif

/* must be the last include */
#ifdef MEMWATCH
#include <memwatch.h>
#endif

#define ESOAP_PORT  8080
#ifdef WIN32
#define DEFAULT_ROOT		"c:\\abyss"
#define DEFAULT_DOCS		DEFAULT_ROOT"\\htdocs"
#define ESOAP_CONF      "esoapserver.conf"
#else
#if defined(__rtems__ )
#define DEFAULT_ROOT		"/abyss"
#else
#define DEFAULT_ROOT		"/usr/local/abyss"
#endif
#define DEFAULT_DOCS		DEFAULT_ROOT"/htdocs"
#if defined(__rtems__ )
#define ESOAP_CONF      DEFAULT_ROOT"/conf/abyss.conf"
#else
#define ESOAP_CONF      "esoapserver.conf.unix"
#endif
#endif

// register the sample methods...
extern void registerCommonMethods();




#ifdef ESOAP_ENABLE_APACHE

// As an Apache Module
#undef  ESOAP_CORE_EXPORT
#ifdef WIN32
#define ESOAP_CORE_EXPORT  __declspec( dllexport )
#else
#define  ESOAP_CORE_EXPORT
#endif
/************************************************************
 This is how you should configure apache.

	LoadModule esoap_module [path]/esoapvc6.dll
	<LocationMatch "/[rR][pP][cC][rR][oO][uU][tT][eE][rR]">
	    SetHandler esoap_module
	</LocationMatch>
    esoapModuleName [path]\esoapserver.dll
    esoapEntryPoint registerUserMethods

*************************************************************/
/**
 * This is the user's entry point of the esoapserver example, when 
 * it is compiled to run as an Apache Module. 
 * 
 * It is called when the module  it is inittialized. 
 * All user's initialization should go here.
 * This function should never block, and register all functions
 * or instances that are going to be called back by the eSoap
 * framework.
 *
 * This function should always be exported as "C" linkage to 
 * avoid name mangling.
 */
extern "C" 
{

void ESOAP_CORE_EXPORT registerUserMethods()
{
  registerCommonMethods();
}

}

#else

// As a Standalone server.

void copyright()
{
  SYSLOG("Embedded SOAP Server( eSoap ): " ESOAP_VERSION "\nBy:Rosimildo da Silva\n\n");
}

int main(int, char ** )
{
  copyright();

#ifdef __ECOS
    init_all_network_interfaces();
    if( !eth0_up ) 
    {
	   assert( 0 );
	}
#endif

#ifdef ESOAP_ENABLE_CGI
  esoap::ServerFactory::create( esoap::ServerFactory::CGI );
#else
  esoap::ServerFactory::create( esoap::ServerFactory::ABYSS );
  bool useFiles = true;
#ifdef __ECOS
  useFiles = false;
#endif
  esoap::Server::instance()->init( "eSOAPServer", ESOAP_PORT, ".", 0, useFiles );
//  esoap::Server::instance()->setBasicAuthentication( "joe", "esoap" );
#endif

  // register the methods for this service.
  registerCommonMethods();

  // run the server...
  esoap::Server::instance()->run();

  // delete current server.
  esoap::Server::setInstance( 0 );
  return 0;
}


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -