📄 echo_impl_cb.cpp
字号:
/*
Created by eSoap Code Generator for C++, Version - 1.08
**** DO NOT EDIT THIS FILE. *****
Time: Tue Sep 11 10:13:49 2001
*/
#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[] =
{
{ "registerCallback", &Echo_Impl::registerCallback_impl },
{ "deRegisterCallback", &Echo_Impl::deRegisterCallback_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[] =
{
{ "registerCallback", &Echo_Impl::registerCallback_impl },
{ "deRegisterCallback", &Echo_Impl::deRegisterCallback_impl },
};
for( int i = 0; i < sizeof( listMethods ) / sizeof( listMethods[ 0 ] ); i++ )
{
esoap::Server::instance()->getRegistry().removeMethod(listMethods[i].name );
}
}
int Echo_Impl::registerCallback_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_clientUrl = mdata->in()->getRealParameter( m->getParameter( "clientUrl" ) );
if( !l_clientUrl )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Parameter = [clientUrl]" );
return 0;
}
esoap::String i_clientUrl = l_clientUrl->getString();
esoap::Parameter *l_rate = mdata->in()->getRealParameter( m->getParameter( "rate" ) );
if( !l_rate )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Parameter = [rate]" );
return 0;
}
int i_rate = l_rate->getInteger();
esoap::Parameter *l_initCount = mdata->in()->getRealParameter( m->getParameter( "initCount" ) );
if( !l_initCount )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Parameter = [initCount]" );
return 0;
}
int i_initCount = l_initCount->getInteger();
esoap::String o_handle;
o_handle = registerCallback( i_clientUrl, i_rate, i_initCount );
esoap::Method *resp = mdata->out()->setMethod( "m:registerCallbackResponse", NS_URI );
resp->addString( "handle", o_handle );
return 0;
}
int Echo_Impl::deRegisterCallback_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_handle = mdata->in()->getRealParameter( m->getParameter( "handle" ) );
if( !l_handle )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Parameter = [handle]" );
return 0;
}
esoap::String i_handle = l_handle->getString();
bool o_result;
o_result = deRegisterCallback( i_handle );
esoap::Method *resp = mdata->out()->setMethod( "m:deRegisterCallbackResponse", NS_URI );
resp->addBoolean( "result", o_result );
return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -