| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1239 人关注过本帖
标题:使用GSOAP 通过HTTPS调用WEBSERVICE失败,请问是何原因呢?
只看楼主 加入收藏
seuprogramme
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-8-6
收藏
 问题点数:0 回复次数:0 
使用GSOAP 通过HTTPS调用WEBSERVICE失败,请问是何原因呢?
WEBSERIVE是我自己建的,TOMCAT6配置无误,在浏览器里输入http://localhost:9999/webserviceserve和https://localhost:11111/webserviceserve都能够打开,在VS2008中调用其接用其接口,vs各个环境也配置无误。
当soap_endpoint = "http://172.20.55.61:9999/webserviceserve/services/HelloWebService"时,调用成功,代码如下:
void CgsoapssltestDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
HelloWebServiceHttpBindingProxy hi;
_ns1__example example;
_ns1__exampleResponse exampleResponse;
CString str;

string str2="helloworld";
example.in0=&str2;
struct soap mysoap;

soap_init(&mysoap);

if(hi.example(&example,&exampleResponse)==SOAP_OK)
{
str=exampleResponse.out->c_str();
MessageBox(str);
}
else[/color]   
  {
MessageBox(L"failed:" );


}
}



当soap_endpoint = "https://172.20.55.61:11111/webserviceserve/services/HelloWebService"时,调用失败,代码如下:
void CgsoapssltestDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
HelloWebServiceHttpBindingProxy hi;
_ns1__example example;
_ns1__exampleResponse exampleResponse;
CString str;

string str2="helloworld";
example.in0=&str2;
struct soap mysoap;

soap_ssl_init();
soap_init(&mysoap);

  和上段不同的地方是加了如下代码
if ( soap_ssl_client_context(&mysoap,
SOAP_SSL_DEFAULT, /* use SOAP_SSL_DEFAULT in production code */
NULL, /* keyfile: required only when client must authenticate to
server (see SSL docs on how to obtain this file) */
NULL, /* password to read the keyfile */
"client.pem",/* optional cacert file to store trusted certificates */
"d:\\", /* optional capath to directory with trusted certificates */
NULL /* if randfile!=NULL: use a file with random data to seed randomness */
))
{
soap_print_fault(&mysoap,stderr);
MessageBox(L"ERROR: failed to set context!");
}
if(hi.example(&example,&exampleResponse)==SOAP_OK)
{
str=exampleResponse.out->c_str();
MessageBox(str);
}
else
{
MessageBox(L"failed:" );


}
}
请问各位高手,如何才能使SSL调用成功呢
搜索更多相关主题的帖子: 失败 WEBSERVICE GSOAP HTTPS 
2010-08-06 14:51
快速回复:使用GSOAP 通过HTTPS调用WEBSERVICE失败,请问是何原因呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015336 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved