回 帖 发 新 帖 刷新版面

主题:gsoap调用SSL失败,不知是何原因!

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    
  {
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);

  和上段不同的地方是加了如下代码
[color=800000]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!");
}[/color]
if(hi.example(&example,&exampleResponse)==SOAP_OK)
{
str=exampleResponse.out->c_str();
MessageBox(str);
}
else
{
MessageBox(L"failed:" );


}
}
请问各位高手,如何才能使SSL调用成功呢

回复列表 (共1个回复)

沙发

你好.我是全职网赚工作者.
如果你有时间有电脑.会打字.
想在网络上创业.请联系我..
项目绝对真实.详情QQ空间资料
加盟请联系 QQ908889846

我来回复

您尚未登录,请登录后再回复。点此登录或注册