c++ - WSO2 C++ 客户端应用程序在调用 Environment::initialize 方法时崩溃

标签 c++ visual-studio-2010 wso2

我正在使用 WSO2 框架为我的一个项目编写基于 C++ 的 Web 服务。我能够安装框架、运行轴服务器并使用示例客户端程序对其进行测试。

当我尝试自己编写客户端时,代码编译时没有任何问题或警告。但是,应用程序在运行时崩溃而没有正确的消息。我尝试放置一些控制台 std::count 并发现崩溃是在调用 Environment::initialize 方法期间发生的。请参阅下面的客户端代码。这几行构成了整个客户端应用程序,因此没有遗漏任何代码。

int main(int argc, char *argv[]){

服务客户端 * sc;
环境::初始化("hello.log", AXIS2_LOG_LEVEL_TRACE);
string end_point = "http://localhost:9090/axis2/services/hello";
sc = new ServiceClient(end_point);
OMElement * payload = new OMElement("问候");
payload->setText("你好服务!");
尝试
{
   OMElement* response = sc->request(payload, "");
    如果(回应)
    {
        cout << endl << "响应:"<< response << endl;
    }
}
 catch (AxisFault & e)
{
    如果 (sc->getLastSOAPFault())
    {
        cout << endl << "错误:"<< sc->getLastSOAPFault() << endl;
    }
    别的
    {
        cout << endl << "错误:"<< e << endl;
    }
}
删除有效负载;

}

我在 IDE 和编译器中使用 Visual Studio 2010。我已经包含了所有标题和必要库的路径 [axutil.lib;axiom.lib;axis2_parser.lib;axis2_engine.lib;wso2_wsf.lib;].

代码编译在调试和 Release模式下都没有问题。应用程序在运行时崩溃。

非常感谢任何帮助。

先谢谢你, 普拉迪普。

最佳答案

根据 this thread :

This problem occurs when you are linking a release binary to a debug binary. The memory structure for debug build and release build is different and sometimes this can cause issues. Best thing would be for build WSF/CPP with debug enabled. Then the problem should go away. Or you can build your sample as a release build.

因此,您有两个选择:

  • 在 Release模式下编译。
  • 在启用调试的情况下重建 WSO2 WSF/C++。您可以在源项目的 configure.ini 文件(或多个文件)中激活此选项。

关于c++ - WSO2 C++ 客户端应用程序在调用 Environment::initialize 方法时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14369946/

相关文章:

c++ - 一次播放多个声音并从我们离开的地方继续

c++ - QTreeWidget childAt(int x, int y) 返回 NULL

c++ - STL映射和纯虚基类

c++ - 调整列表列大小时 HDN_ENDTRACK 出现问题

C++ UDP 在一个类中接收一个 vector

visual-studio-2010 - 更新 JScript 智能感知挂起 VS 2010

debugging - 从 Visual Studio 使用 Windbg

Wso2 5.9 覆盖文件

ssl - Siddhi http-sink 忽略 ssl 证书错误

wso2 - WSO2 ESB 和 WSO2 EI 集成哪一个更好