ruedi
ruedi

Reputation: 5545

How to secure datatransfer via soap in the request?

I use Soap to get my data from a webservice. The way I go is sending a HttpWebRequest with Password and Username. The provider gave me something like https://www.myprovider.com and the names of the methods they offer like get_data_as_bytes, get_data_as_XML and so on. My question now is, is this procedure secure, since I do not have a code to decode anything it looks to me that the data going through the internet unencrypted. Or do I have to set something in the SOAP File to ask for encryption?

The SOAP is build like:

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"

Upvotes: 0

Views: 37

Answers (1)

Neil Smithline
Neil Smithline

Reputation: 1586

For HttpWebRequest you canspecify the protocol as https to use SSL/TLS. Making your SOAPAction URL be https://tempuri.org/ should do it.

PS: On Windows, you can install netmon or Fiddler to see what protocol is being used for each message.

Upvotes: 1

Related Questions