写简单的 WSO2/C++ 崩溃 网络服务客户端

发布于 2024-07-11 22:10:03 字数 1883 浏览 5 评论 0原文

是否有人能够使用 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 的源代码进行构建,并逐步执行崩溃的代码,但我希望有人以前遇到过这个问题并能立即得到一些反馈。

Has any been able to successfully run with a client using the WSO2/C++ web services package? I've tried just about everything I can think of yet every time I try to run a very simple client I get a crash. Here's some sample code from one of their example programs...

#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;
}

I get a crash every time at the point of the WRESTClient object construction. It appears to be an issue somewhere in the WSO2 code but I don't get any error message indicating what the exact problem is. My next step will be to build against the source for WSO2 and step through the code which is crashing but I'm hoping someone has encountered this issue before and has some immediate feedback.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冬天旳寂寞 2024-07-18 22:10:03

您是否考虑过在 WRESTClient 对象构造周围放置一个 try/catch-all 块? 如果您在这条线上进行核心转储,那么它很可能会抛出异常,如果您捕获它,那么您可能能够从该异常中获取更多有用的错误信息。

除此之外,是时候按照您的建议来打破调试器了。

Have you considered putting a try/catch-all block around the WRESTClient object construction? If you're core dumping on this line then the chances are that it's throwing an exception, and if you catch it then you might be able to get more useful error information out of that exception.

Other than that, time to break out the debugger as you suggested.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文