简体   繁体   中英

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. 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. 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. I have included the paths for all headers and necessary libraries [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. 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. You can activate this option in the configure.ini file (or files) in the source project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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