本文介绍了SSL SOAP连接无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我已经看过很多关于这个问题的帖子,但是还没能用它们来解决我的问题。我使用c ++和.net建立使用SSL的服务器的SOAP / XML连接。我之前没有这样做过,所以我在黑暗中拍摄了一下。我已经获得了有效的509证书,但无论我如何安排,我都会得到"无法建立SSL / TLS安全通道的信任关系"。信息。我的cuurent代码片段执行以下操作: LoginUserSEIService ^ loginService =I've seen numerous posts to this issue but have not been able to solve my problem using them. I am using c++ and .net to set up a SOAP/XML connection to a server using SSL. I have not done this before so I'm shooting in the dark a bit. I have been supplied a valid 509 certificate but no matter how I arrange it I get the "Could not establish trust relationship for the SSL/TLS secure channel" message. My cuurent code snippet does the following:LoginUserSEIService ^loginService = gcnew LoginUserSEIService(); // SOAP函数 Uri ^ myUri =gcnew LoginUserSEIService(); // SOAP FunctionUri ^myUri = gcnew Uri( " https://nase.amc.faa.gov:443 / userprofiling / usersession / loginUser / loginUser" ) ; ServicePoint ^ mySP = ServicePointManager :: FindServicePoint(myUri); certStore-> Open(OpenFlags :: ReadWrite); certStore->添加(证书); X509Certificate ^ xcert = X509Certificate :: CreateFromCertFile(gcnew Uri("https://nase.amc.faa.gov:443/userprofiling/usersession/loginUser/loginUser");ServicePoint ^mySP = ServicePointManager::FindServicePoint( myUri );certStore->Open(OpenFlags::ReadWrite);certStore->Add(certificate);X509Certificate ^xcert = X509Certificate::CreateFromCertFile( " c:\\ temp \\cert \\\ \\ _nase-amc-faa-gov.crt" );; HttpWebRequest ^ myRequest ="c:\\temp\\cert\\nase-amc-faa-gov.crt");;HttpWebRequest ^myRequest = dynamic_cast < HttpWebRequest ^>(WebRequest ::创建(mySP->地址)); myRequest-> KeepAlive =dynamic_cast<HttpWebRequest^>(WebRequest::Create(mySP->Address));myRequest->KeepAlive = true ; myRequest-> ClientCertificates->添加(xcert);true;myRequest->ClientCertificates->Add(xcert); myRequest-> CookieContainer =myRequest->CookieContainer = gcnew CookieContainer(); myRequest-> Timeout = 600000;gcnew CookieContainer();myRequest->Timeout = 600000; HttpWebResponse ^ myResp =HttpWebResponse ^myResp = dynamic_cast < HttpWebResponse ^>(myRequest-> GetResponse()); dynamic_cast<HttpWebResponse^>(myRequest->GetResponse()); 尝试 { userId = loginService-> loginUser(try{userId = loginService->loginUser( " uname" , "密码" , false ); //在此处生成消息 }"uname","password",false); //Generates Message here} catch (例外^ e) {catch(Exception ^e){ String ^ myString = String :: Format(String ^myString = String::Format( "DENIED:{0}" ,e-> Message); MessageBox :: Show(myString,"DENIED: {0} ",e->Message);MessageBox::Show(myString, " PERMISSIONS" ,MessageBoxButtons :: OK, MessageBoxIcon :: Stop) ;"PERMISSIONS",MessageBoxButtons::OK,MessageBoxIcon::Stop); }推荐答案如果是服务器证书cate无效,那么你应该检查原因并修复它。If the server certificate is not valid then you should check why and fix it. 这篇关于SSL SOAP连接无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 20:46