2
是否能够使用WSO2/C++ web服务包成功运行客户端?我尝试过所有我能想到的事情,但每次尝试运行一个非常简单的客户端时,我都会遇到崩溃。下面是他们的榜样方案之一了一些示例代码...崩溃编写简单的WSO2/C++ Web服务客户端
#include <stdio.h>
#include <WSRESTClient.h>
#include <OMElement.h>
#include <iostream>
#include <AxisFault.h>
using namespace std;
using namespace wso2wsf;
int _tmain(int argc, _TCHAR* argv[])
{
WSRESTClient * sc = new WSRESTClient("http://localhost:9090/axis2/services/echo/echoString");
try
{
sc->initializeClient("echo_rest.log", AXIS2_LOG_LEVEL_TRACE);
}
catch (AxisFault & e)
{
cout << endl << "Error: " << e << endl;
return 0;
}
Options * op = sc->getOptions();
op->setHTTPMethod(AXIS2_HTTP_GET);
sc->setOptions(op);
{
OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
OMElement * payload = new OMElement(NULL,"echoString", ns);
OMElement * child = new OMElement(payload,"text", NULL);
child->setText("Hello World!");
cout << endl << "Request: " << payload << endl;
OMElement * response;
try
{
response = sc->request(payload, "http://ws.apache.org/axis2/c/samples/echo/soap_action");
if (response)
{
cout << endl << "Response: " << response << endl;
}
}
catch (AxisFault & e)
{
cout << endl << "Error: " << e << endl;
}
delete payload;
}
delete sc;
return 0;
}
每次都遇到崩溃的WRESTClient对象施工点。这似乎是WSO2代码中的一个问题,但我没有收到任何错误消息,指出确切的问题是什么。我的下一步将是针对WSO2的源代码进行构建,并逐步浏览崩溃的代码,但我希望以前有人遇到过这个问题,并有一些即时反馈。