是否有任何已经能够成功地与使用 WSO2 / C ++网络服务的客户端运行包?我已经尝试过几乎所有我能想到却每次我试图运行一个非常简单的客户我得到一个崩溃的时间。下面是一些示例代码从它们的示例程序之一...

#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并通过它崩溃,但我希望以前有人遇到过这个问题,并有一些即时反馈单步执行代码。

有帮助吗?

解决方案

你有没有考虑把一个try / catch-各地的WRESTClient对象的构造块?如果你在该行核心转储,则有机会,它抛出一个异常,如果你抓住它,那么你也许能够获得更多有用的错误信息指出,例外的。

除此之外,时间打出来的调试器如你所说。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top