【发布时间】:2015-04-17 01:14:44
【问题描述】:
我使用 Soap 从 Web 服务获取数据。我的方式是发送一个带有密码和用户名的 HttpWebRequest。提供者给了我https://www.myprovider.com 之类的东西,以及他们提供的方法的名称,例如get_data_as_bytes、get_data_as_XML 等等。我现在的问题是,这个过程是否安全,因为我没有代码来解码任何在我看来通过互联网未加密的数据。还是我必须在 SOAP 文件中设置一些东西来请求加密?
SOAP 的构建方式如下:
Dim soapStr As String = "<?xml version=""1.0"" encoding=""utf-8""?>" & vbCr & vbLf & " <soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""" & vbCr & vbLf & " xmlns:xsd=""http://www.w3.org/2001/XMLSchema""" & vbCr & vbLf & " xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & vbCr & vbLf & " <soap:Body>" & vbCr & vbLf & " <{0} xmlns=""http://tempuri.org/"">" & vbCr & vbLf & " {1}" & vbCr & vbLf & " </{0}>" & vbCr & vbLf & " </soap:Body>" & vbCr & vbLf & " </soap:Envelope>"
Dim req As HttpWebRequest = DirectCast(WebRequest.Create(Url), HttpWebRequest)
req.Headers.Add("SOAPAction", (Convert.ToString("""http://tempuri.org/") & methodName) + """")
req.ContentType = "text/xml;charset=""utf-8"""
req.Accept = "text/xml"
req.Method = "POST"
【问题讨论】:
标签: .net security soap httpwebrequest