64,646
社区成员
发帖
与我相关
我的任务
分享
//client 代码
int SendMsg(const char* server,char** szMsgXml);
int main(int argc, char* argv[])
{
int result=-1;
char* server="http://localhost:4567";
if (argc<1)
{
printf("usage: %s sxMsgXml\n",argv[1]);
exit(0);
}
result=SendMsg(server,&argv[1]);//调用方法传递字符串给server
if (result<0)
{
printf("soap error!\n");
}
else
{
printf("now the szMsgXml is:%s\n",argv[1]);
}
system("pause");
return 0;
}
int SendMsg( const char* server,char** szMsgXml )
{
struct soap sendMsg_soap;
int result=0;
soap_init(&sendMsg_soap);
soap_call_ns__SendMsg(&sendMsg_soap,server,"",szMsgXml);
if (sendMsg_soap.error)//这里szMsgXml的值已经为空了
{
printf("\nsoap error:%d,%s,%s\n",sendMsg_soap.error,*soap_faultcode(&sendMsg_soap),*soap_faultstring(&sendMsg_soap));
result=sendMsg_soap.error;
}
soap_end(&sendMsg_soap);
soap_done(&sendMsg_soap);
return result;
}
//server 代码
int ns__SendMsg(struct soap*, char **szMsgXml)
{
//这里传进来的szMsgXml的值为空
printf("the xml content:%s\n",*szMsgXml);
return SOAP_OK;
}