免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 8851 | 回复: 1
打印 上一主题 下一主题

[C++] gsoap Error 200 fault:SOAP-ENV:Client [no subcode] [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-08-28 15:56 |只看该作者 |倒序浏览
最近在用gsoap进行web service 客户端的开发,现在使用c进行开发,连接用java开发的服务器,现在连接不上,调试了好久,都还是不行,下面我贴下代码,牛人给指导一下:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "Service.nsmap"
#include "soapH.h"

#define GROUPID        "12"

int get_list (const char *server, struct _ns2__GetDeviceList *send,
                struct _ns2__GetDeviceList_Rsp *recv);

int
main (int argc, char **argv)
{
        int result;
        struct _ns2__GetDeviceList list1;
        struct _ns2__GetDeviceList_Rsp list2;


        const char server[] = "http://192.168.14.48:8080/megaWS/services/Service?wsdl";
//        const char server[] = "192.168.14.48:8181";

        list1.WSRequest->GroupId = (char *)malloc(10 * sizeof(char));

        if(list1.WSRequest->GroupId == NULL)
        {
                printf("malloc error\n");
                exit(1);

        }
        printf("-------------------start to connect service server!--------------------\r\n");
        memcpy ((list1.WSRequest)->GroupId, GROUPID, 2);
        printf("--->Groupid is %s\r\n", list1.WSRequest->GroupId);
        result = get_list (server, &list1, &list2);
        if (result != 0)
        {
                printf ("get list error:%d\n", __LINE__);
                printf ("soap error, errcode=%d\n", result);
        }
        else
        {
                printf ("-->get_list successful!\n");
                printf("__sizeDeviceItem is :%d\r\n", list2.DeviceInfo->DeviceList->__sizeDeviceItem);
                //list2.ns2__GetDeviceList_Req->DeviceInfo->DeviceList->DeviceItem
                printf("DeviceId\t\tName\t\tStatus\t\t\n");
                printf("%s\t\t%s\t\t%s\t\t\n",
                                list2.DeviceInfo->DeviceList->DeviceItem->DeviceId,
                                list2.DeviceInfo->DeviceList->DeviceItem->Name,
                                list2.DeviceInfo->DeviceList->DeviceItem->Status);
        }
        return 0;
}

int
get_list (const char *server, struct _ns2__GetDeviceList *send,
                struct _ns2__GetDeviceList_Rsp *recv)
{
        int result;
        struct soap black_soap;

        soap_init (&black_soap);
        soap_set_namespaces (&black_soap, namespaces);
        printf("--->to call the soap_call___ns1__GetDeviceList\r\n");
        if(soap_call___ns1__GetDeviceList (&black_soap, server, NULL, send, recv) == SOAP_OK)
        {
                printf("soap is ok!\r\n");
        }
        else
        {
                soap_print_fault(&black_soap, stderr);
        }
        soap_call___ns1__GetDeviceList (&black_soap, server, NULL, send, recv);
/*        if (black_soap.error)
        {
                printf ("soap error: %d, %s, %s\n", black_soap.error,
                                *soap_faultcode (&black_soap), *soap_faultstring (&black_soap));
                result = black_soap.error;
        }*/
        printf("the funtion soap_call___ns1__GetDeviceList is return!\r\n");
        soap_end (&black_soap);
        soap_done (&black_soap);
        return result;
}

出现如下错误:
Error 200 fault: SOAP-ENV:Client [no subcode]
"Error 200"
Detail: [no detail]

现在的问题:连接不上服务器 调用soap_call___ns1__GetDeviceList 传入的server不同错误不一样。
const char server[] = "http://192.168.14.48:8080/megaWS/services/Service?wsdl";
const char server[] = "192.168.14.48:8080";
这两种全是错误的
服务器IP 192.168.14.48 port是8080 以何种方式才能正确连接呢?

论坛徽章:
0
2 [报告]
发表于 2013-08-28 16:24 |只看该作者
差了很多资料,网上说要将server[]换成全路径、、但是不知道怎么才是全路径,我刚刚接触gsoap,所以大家多多指教、、、
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP