echo_proxy.cpp

来自「ESOAP是一款专注于嵌入式web service开发的工具 压缩包里提供了基」· C++ 代码 · 共 112 行

CPP
112
字号
/*
 Created by eSoap Code Generator for C++, Version - 1.08
 **** DO NOT EDIT THIS FILE.  *****
 Time: Tue Sep 11 10:13:49 2001
*/

#include "soap_envelope.h"
#include "Echo_proxy.h"


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

static const char *__client_code = 
"SOAP-CODE:Client";
static const char *__client_param =
"Error: parsing parameter.";


const char *Echo_Proxy::NS_URI = "http://tempuri.com/";
const char *Echo_Proxy::SOAP_ACTION = "http://tempuri.com/";

Echo_Proxy::Echo_Proxy( const char *url, unsigned long timeout )
{
   __ht = esoap::TransportFactory::create( url, esoap::TransportFactory::HTTP );
   __ht->setTimeout( timeout );
}

Echo_Proxy::~Echo_Proxy()
{
   delete __ht;
}

esoap::String Echo_Proxy::registerCallback(
                  const esoap::String & clientUrl,
                  const int rate,
                  const int initCount )
{
  esoap::Envelope    __env;
  esoap::Method *__m = __env.setMethod( "m:registerCallback", NS_URI );
  __m->addString( "clientUrl", clientUrl );
  __m->addInteger( "rate", rate );
  __m->addInteger( "initCount", initCount );
  esoap::Envelope *__in = __ht->call( __env, SOAP_ACTION );
  if( !__in->success() )
  {
     esoap::SoapException __ex( __in->getFault() );
     delete __in;
     throw __ex;
  }
  esoap::Method *__resp = __in->getMethod();
  if( !__resp )
  {
     delete __in;
     throw esoap::SoapException( __client_code, __client_param );
  }
  {  esoap::Parameter *__p;
      if( __resp->getParameterCount() == 1 )
         __p = __in->getRealParameter( __resp->getParameter( 0 ) );
      else 
         __p = __in->getRealParameter( __resp->getParameter( "handle" ) );
     if( !__p )
     {
       delete __in;
       throw esoap::SoapException( __client_code, __client_param );
     }
    esoap::String __o_r = __p->getString();
     delete __in;
     return __o_r;
  }
}

bool Echo_Proxy::deRegisterCallback(
                  const esoap::String & handle )
{
  esoap::Envelope    __env;
  esoap::Method *__m = __env.setMethod( "m:deRegisterCallback", NS_URI );
  __m->addString( "handle", handle );
  esoap::Envelope *__in = __ht->call( __env, SOAP_ACTION );
  if( !__in->success() )
  {
     esoap::SoapException __ex( __in->getFault() );
     delete __in;
     throw __ex;
  }
  esoap::Method *__resp = __in->getMethod();
  if( !__resp )
  {
     delete __in;
     throw esoap::SoapException( __client_code, __client_param );
  }
  {  esoap::Parameter *__p;
      if( __resp->getParameterCount() == 1 )
         __p = __in->getRealParameter( __resp->getParameter( 0 ) );
      else 
         __p = __in->getRealParameter( __resp->getParameter( "result" ) );
     if( !__p )
     {
       delete __in;
       throw esoap::SoapException( __client_code, __client_param );
     }
    bool __o_r = __p->getBoolean();
     delete __in;
     return __o_r;
  }
}

}

⌨️ 快捷键说明

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