关于实现使用浏览器获取gsoap服务wsdl的实现

可以使用以下3种方式获取显示服务的wsdl

 

1.http://172.168.1..242/BlackLstSer.wsdl

2.http://172.168.1..242/BlackLstSer?wsdl

3.http://172.168.1..242/BlackLstSer

 

BlackLstSer是wsdl文件名,需要放在程序的当前运行目录。

 

static int
http_get(struct soap *soap)
{
 std::string path;
 FILE* fd=NULL;
 char* s=strchr(soap->path, '?');
 char* d=strchr(soap->path, '/');
 char* dd=strchr(soap->path, '.');
 
 if(!s||strcmp(s,"?wsdl"))
 {
  if(!d)
   return SOAP_GET_METHOD;
   
 }
 
 path.assign(d+1);
 int index=path.find('?');
 if(index==std::string::npos)
 {
  if(path.find('.')==std::string::npos)
   path+=".wsdl";
 }
 else
 {
  path[index]='.';
 }
 
 fd=fopen(path.c_str(), "rb");
 if(!fd)
  return 404;
 soap->http_content="text/xml";
 soap_response(soap, SOAP_FILE);
 for(;;)
 {
  memset(soap->tmpbuf, 0x0, sizeof(soap->tmpbuf));
  size_t len=fread(soap->tmpbuf, 1, 2048, fd);
  if(!len)
   break;
  if(soap_send_raw(soap,soap->tmpbuf, len));
   break;

 }
 fclose(fd);
 soap_end_send(soap);
 return SOAP_OK;
}

 

解决方案一:

  将以上代码放覆盖stdsoap2.cpp/.c 文件中的http_get函数。

解决方案二:

  自己实现以上函数,函数名可以自己定。格式(返回值和参数的个数以及类型)要和http_get的一致。比如:static int my_http_get(struct soap *soap)

然后在初始化soap环境变量的时候,设置soap.http_get=my_http_get

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值