【问题标题】:How to catch exceptions from gsoap?如何从 gsoap 中捕获异常?
【发布时间】:2010-07-05 09:40:20
【问题描述】:

我目前正在构建一个基于 gsoap 的 iphone 应用程序用于通信。我正在尝试管理连接问题,当设备未连接到主机时,我找不到任何特定的返回语句。

有没有办法在运行 gsoap send 或 reicv 方法时获得某种异常?

感谢您的帮助,

罗曼

【问题讨论】:

  • 解决方案终于傻了。如果成功,生成的请求将返回语句 SOAP_OK。在 iphone 的情况下,测试是这样的:soap_call___method(&soap,NULL,NULL, &request,&response) == SOAP_OK
  • 查看设备是否连接到主机,可以使用Reachability代码。

标签: iphone soap exception-handling gsoap


【解决方案1】:

http://www.cs.fsu.edu/~engelen/soap.html 甚至还有一个有用的功能可以打印人类可读的错误消息:

#include "soapcalcProxy.h"  // get proxy 
#include "calc.nsmap"    // get namespace bindings 
int main() 
{ 
   calc s; 
   double r; 
   if (s.ns2__add(1.0, 2.0, r) == SOAP_OK) 
      std::cout << r << std::endl; 
   else
      soap_print_fault(s.soap, stderr); 
   return 0; 
}

【讨论】:

    猜你喜欢
    • 2018-07-14
    • 1970-01-01
    • 2019-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-26
    • 2010-12-27
    相关资源
    最近更新 更多