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

📄 binary_client.cpp

📁 ESOAP是一款专注于嵌入式web service开发的工具 压缩包里提供了基本的例子
💻 CPP
字号:
/////////////////////////////////////////////////////////////////////////////
// $Id: binary_client.cpp,v 1.4 2001/09/11 12:02:57 rosimildo Exp $
//
// Copyright (c) 2001 Exor International Inc. All rights reserved.
//
// MODULE DESCRIPTION: A simple example to show how to transfer
// binary information using the eSoap kit.
//
// MODIFICATION/HISTORY:
//
// $Log: binary_client.cpp,v $
// Revision 1.4  2001/09/11 12:02:57  rosimildo
// changed copyright from Technopoint to Exit; updated version to 0.9
//
// 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 <assert.h>
#include "Echo_proxy.h"

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


static void writeImage( char *filename, char *input,  size_t len )
{
   FILE *fp = fopen( filename, "wb" );
   assert( fp );
   fwrite( input, 1, len, fp );
   fclose( fp );
}

int main(int argc, char **argv)
{
  echo::Echo_Proxy proxy( ESOAP_SERVER_URL, 30 );
  try
  {
     printf( "Echo: calling getGIF() method.\n" );
     esoap::Packet image = proxy.getGIF();
     printf( "Echo: getGIF() ok -- saving local image.\n" );
     writeImage( "myImage.gif", image.c_str(), image.size() );
  }
  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 + -