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

📄 array_client.cpp

📁 ESOAP是一款专注于嵌入式web service开发的工具 压缩包里提供了基本的例子
💻 CPP
字号:
/////////////////////////////////////////////////////////////////////////////
// $Id: array_client.cpp,v 1.5 2001/09/11 12:03:38 rosimildo Exp $
//
// Copyright (c) 2001 Exor International Inc. All rights reserved.
//
// MODULE DESCRIPTION: A simple "echo" example to show how
// the toolkit deals with arrays.
//
// MODIFICATION/HISTORY:
//
// $Log: array_client.cpp,v $
// Revision 1.5  2001/09/11 12:03:38  rosimildo
// changed copyright from Technopoint to Exit; updated version to 0.9
//
// Revision 1.4  2001/09/10 22:52:59  rosimildo
// Added basic auth.
//
// Revision 1.3  2001/09/09 14:19:52  rosimildo
// Added some comments. Added copyright.
//
// Revision 1.2  2001/09/09 12:37:44  rosimildo
// Updated code for esoapcg 1.08. Added small comments to the
// clients main cpp module.
//
//
// Created 2001/09/10 Rosimildo da Silva, ConnectTel Inc.
// [rdasilva@connecttel.com]
//
/////////////////////////////////////////////////////////////////////////////

#include <stdio.h>
#include "Echo_proxy.h"

#define ESOAP_SERVER_URL "http://localhost:8080/rpcrouter"

int main(int argc, char **argv)
{
  echo::Echo_Proxy proxy( ESOAP_SERVER_URL, 30 );


  // IMPORTANT: This tell the client to send on all requests the
  // HTTP "basic authentication" mechanism.
  esoap::Transport *ht = proxy.getTransport();
  ht->setBasicAuthentication( "joe", "esoap" );
  try
  {
     esoap_Vector< int > a;
	  a.push_back( 1 );
	  a.push_back( 2 );
	  a.push_back( 3 );

     printf( "Echo: calling echo() method.\n" );
     esoap_Vector< int > *res = proxy.echo( a );
     printf( "Echo: OK - size ==> %d,  [ ", res->size() );
	  for( int i = 0; i < res->size(); i++ )
	  {
       printf( "%d ", (*res)[ i ] );
	  }
     printf( " ]\n" );
     delete res;
  }
  catch( esoap::SoapException & e )
  {
    printf( "SOAP Fault: Code=%s, String=%s\n", 
    		 e.getCode().c_str(), e.getString().c_str() );
  }
  catch( ... )
  {
    printf( "Weird C++ error. Please fix your code. :-)\n" );
  }
  // just to cleanup the memory...
  delete esoap::ParameterFactory::setInstance( 0 );
  return 0;
}

⌨️ 快捷键说明

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