📄 echo_impl_cb.cpp
字号:
/*
Created by eSoap Code Generator for C++, >>> DEMO <<< Version - 1.08
**** DO NOT EDIT THIS FILE. *****
Time: Sun Sep 09 09:37:32 2001
**** CODE CREATED USING AN UNREGISTERED VERSION OF ESOAPCG.
Please, after the initial testing, you *MUST* buy a
copy of this application to continue using it.
* Limits of this version:
+ 5 functions per interface
+ 5 User defined types( Complex Types )
*/
#include <assert.h>
#include "soap_server.h"
#include "soap_envelope.h"
#include "Echo_impl.h"
/* must be the last include */
#ifdef MEMWATCH
#include <memwatch.h>
#endif
namespace echo {
const char *Echo_Impl::NS_URI = "http://tempuri.com/";
Echo_Impl::Echo_Impl()
: __currentBlock( 0 )
{
}
Echo_Impl::~Echo_Impl()
{
}
void Echo_Impl::activate()
{
typedef MemberCallback< esoap::MethodDataBlock, Echo_Impl > Echo_CB;
struct Echo_MethodPair
{
const char *name;
int (Echo_Impl::*member )(esoap::MethodDataBlock *);
};
static Echo_MethodPair listMethods[] =
{
{ "echo", &Echo_Impl::echo_impl },
};
for( int i = 0; i < sizeof( listMethods ) / sizeof( listMethods[ 0 ] ); i++ )
{
Echo_CB *mc = new Echo_CB( listMethods[i].member, this );
esoap::Server::instance()->getRegistry().addMethod( listMethods[i].name, mc );
}
}
void Echo_Impl::deactivate()
{
typedef MemberCallback< esoap::MethodDataBlock, Echo_Impl > Echo_CB;
struct Echo_MethodPair
{
const char *name;
int (Echo_Impl::*member )(esoap::MethodDataBlock *);
};
static Echo_MethodPair listMethods[] =
{
{ "echo", &Echo_Impl::echo_impl },
};
for( int i = 0; i < sizeof( listMethods ) / sizeof( listMethods[ 0 ] ); i++ )
{
esoap::Server::instance()->getRegistry().removeMethod(listMethods[i].name );
}
}
int Echo_Impl::echo_impl( esoap::MethodDataBlock *mdata )
{
__currentBlock = mdata;
esoap::Method *m = mdata->in()->getMethod();
if( !m )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing method element" );
return 0;
}
esoap::Parameter *l_i = mdata->in()->getRealParameter( m->getParameter( "i" ) );
if( !l_i )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Parameter = [i]" );
return 0;
}
esoap_Vector< int > i_i;
{ esoap::Array *__a = (esoap::Array *)l_i;
for( size_t __i = 0; __i < __a->getParameterCount(); __i++ )
{
esoap::Parameter *__tmp = mdata->in()->getRealParameter( __a->getParameter( __i ) );
if( !__tmp )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Array Parameter = [%d]", __i );
return 0;
}
i_i.push_back( __tmp->getInteger() );
}
}
esoap_Vector< int > *o_return;
o_return = echo( i_i );
esoap::Method *resp = mdata->out()->setMethod( "m:echoResponse", NS_URI );
{
esoap::Parameter *__a = new esoap::Array( "return" );
__a->setType( "xsd:int" );
if( o_return )
{
for( size_t __i = 0; __i < (size_t)o_return->size(); __i++ )
{
__a->addInteger( "item", (*o_return)[ __i ] );
}
}
resp->addParameter( __a );
delete o_return;
}
return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -