简体   繁体   English

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

[英]WSO2 C++ Client application crashes upon calling Environment::initialize method

I am using WSO2 framework for writing web services based on C++ for one of my projects. 我正在使用WSO2框架为我的一个项目编写基于C ++的Web服务。 I am able to install the framework, run the axis server and test it with the sample client programs. 我能够安装框架,运行轴服务器并使用示例客户端程序对其进行测试。

When I tried to write a client by myself, the code compiles without any issues or warnings. 当我尝试自己编写客户端时,代码编译时没有任何问题或警告。 However, the application crashes during run time without a proper message. 但是,应用程序在运行时崩溃,没有正确的消息。 I tried putting some console std::count's and figured out that the crash is happening during the call of Environment::initialize method. 我尝试放置一些控制台std :: count,并发现崩溃是在调用Environment :: initialize方法期间发生的。 Please see below for the client code. 请参阅下面的客户端代码。 These few lines constitute the whole client application, so no code left out. 这几行构成了整个客户端应用程序,因此没有遗漏任何代码。

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

 ServiceClient * sc; Environment::initialize("hello.log", AXIS2_LOG_LEVEL_TRACE); string end_point = "http://localhost:9090/axis2/services/hello"; sc = new ServiceClient(end_point); OMElement * payload = new OMElement("greet"); payload->setText("Hello Service!"); try { OMElement* response = sc->request(payload, ""); if (response) { cout << endl << "Response: " << response << endl; } } catch (AxisFault & e) { if (sc->getLastSOAPFault()) { cout << endl << "Fault: " << sc->getLastSOAPFault() << endl; } else { cout << endl << "Error: " << e << endl; } } delete payload; 

}

I am using Visual Studio 2010 for the IDE & compiler. 我将Visual Studio 2010用于IDE和编译器。 I have included the paths for all headers and necessary libraries [axutil.lib;axiom.lib;axis2_parser.lib;axis2_engine.lib;wso2_wsf.lib;]. 我已经包含所有标头和必需库的路径[axutil.lib; axiom.lib; axis2_parser.lib; axis2_engine.lib; wso2_wsf.lib;]。

Code compilation has no issues, both in debug and release mode. 在调试和发布模式下,代码编译都没有问题。 The app crashes during run time. 应用在运行时崩溃。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Thank you in advance, Pradeep. 预先感谢您,普拉德普。

According to 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. 最好的办法是在启用调试的情况下构建WSF / CPP。 Then the problem should go away. 然后问题应该消失了。 Or you can build your sample as a release build. 或者,您可以将示例构建为发行版本。

So this leaves you with two options: 因此,这给您两个选择:

  • Compile in release mode. 在发布模式下编译。
  • Rebuild WSO2 WSF/C++ with debug enabled. 在启用调试的情况下重建WSO2 WSF / C ++。 You can activate this option in the configure.ini file (or files) in the source project. 您可以在源项目的configure.ini文件中激活此选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM