从VBS文件调用WCF Web服务(在HTTPS下)时遇到问题

时间:2017-11-28 08:35:07

标签: wcf vbscript

我创建了一个包含多个svc文件的WCF WebService。我使用下面的代码从vbscript调用svc文件中的方法:

ScriptTimeOut = 6000000

Dim soapServer, soapMessage

soapServer = "https://example.com/marketyardwebservice/SchedulerClasses/MailIntimations.svc"

soapMessage = "<s:Envelope xmlns:s=" & GetQuotedUrl("http://schemas.xmlsoap.org/soap/envelope/") & ">" & _ 
"<s:body>" & _ 
"<AuctionWinnerSendMail xmlns=" & GetQuotedUrl("http://tempuri.org/") & ">" & _
""

soapMessage = Replace(soapMessage, "'", chr(34))

Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.SetOption 2, xmlhttp.GetOption(2) 
Dim lResolve,lConnect,lSend,lReceive
lResolve = 5 * 1000
lConnect = 60 * 1000
lSend = 600 * 1000
lReceive = 600 * 1000

xmlhttp.setTimeouts lResolve, lConnect, lSend, lReceive

xmlhttp.open "POST", soapServer, False
xmlhttp.setRequestHeader "Man", POST & " " & soapServer & " HTTP/1.1"
xmlhttp.setRequestHeader "SOAPAction", "http://tempuri.org/IMailIntimations/AuctionWinnerSendMail"
xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"

xmlhttp.send(soapMessage)

Function GetQuotedUrl(ByVal value)
    GetQuotedUrl = Chr(34) & value & Chr(34)
End Function    

如果未启用https,则会正确执行上述脚本。但是一旦启用HTTPS,我就会在执行vbscript时遇到以下错误“需要证书来完成客户端身份验证”。

关于我如何解决这个问题,请有人帮助我。 提前致谢

1 个答案:

答案 0 :(得分:0)

在服务器上启用HTTPS时,将客户端证书设置为year = ["2014", "2015"] # yellow red orange pink color= ['yellow', 'red', 'orange', 'pink'] for each_year in year: for each_color in color: in_folder = r"E:/test/" + each_year + "/03_lines/" + each_color [rest of the script]