问题描述
过程:1.wsdl2h-c-omessage.hhttp://192.168.11.168:8076/SendApi.asmx?wsdl2.soapcpp2-c-C-xmessage.h3.测试代码#include"soapH.h"#include"SendApiSoap.nsmap"/*gcc-O2-omessagemessage.csoapC.csoapClient.c-I../-L../-lgsoap*/intmain(intargc,char**argv){intret;structsoapMessagesoap;Messagesoap.userid="xxx";//Messagesoap.passwd="xxx";//Messagesoap.authrealm="";soap_init(&Messagesoap);struct_tempuri__MasAPISendMessagesend;Messagesend.USERNAME="xxx";//Messagesend.USERPWD="xxx";//Messagesend.DESTADDR="13xxx";//手机号Messagesend.SMSCONTENT="hellotheworld!";struct_tempuri__MasAPISendResponseMessagerecv;/*struct_tempuri__MasAPISend{///Element"USERNAME"ofXSDtypexs:string.char*USERNAME0;///<Optionalelement.///Element"USERPWD"ofXSDtypexs:string.char*USERPWD0;///<Optionalelement.///Element"DESTADDR"ofXSDtypexs:string.char*DESTADDR0;///<Optionalelement.///Element"SMSCONTENT"ofXSDtypexs:string.char*SMSCONTENT0;///<Optionalelement.};*///soap_call___tempuri__MasAPISendret=soap_call___tempuri__MasAPISend(&Messagesoap,NULL,NULL,&Messagesend,&Messagerecv);if(ret==SOAP_OK){printf("soapcallsuccessn");}else{printf("soapcallerror,errcodeis%dn",ret);}soap_destroy(&Messagesoap);soap_end(&Messagesoap);soap_done(&Messagesoap);return0;}
4.gcc-O2-omessagemessage.csoapC.csoapClient.c-I../-L../-lgsoap5.执行./messageroot@ubuntu:/home/test#./messagesoapcallerror,errcodeis-1查了下资料,这个错误代码含义是:Unexpectedendoffile,noinput,ortimeoutwhilereceivingdata不知道该怎么解决?哪位遇到过或有解决思路的帮帮忙啊
解决方案
本帖最后由 Yoobsir 于 2014-12-11 14:16:28 编辑
解决方案二:
添加soap_print_fault(&Messagesoap,stderr);发现:Error-1fault:SOAP-ENV:Client[nosubcode]"Endoffileornoinput:Connectionresetbypeer"Detail:[nodetail]