VB to Xojo

Please I need help to convert these functions from VB to Xojo code, your help will be greatly appreciated.

Public Function ConvertToBase64String(file_path As String) As String
Dim binarydata As Byte() = File.ReadAllBytes(file_path)
Return Convert.ToBase64String(binarydata, 0, binarydata.Length)
End Function

Private Function GetNodeValue(rootNodo As String, infoNodo As String, doc As XmlDocument) As String
Dim result As String = “”
Dim node_path As String = “//” + rootNodo + “//” + infoNodo
Dim node As XmlNode = doc.SelectSingleNode(node_path)
If Not IsNothing(node) Then
result = node.InnerText
End If
Return result
End Function

Private Function CreateWebRequest(uri As String, method As String) As HttpWebRequest
Dim webRequest As HttpWebRequest = CType(webRequest.Create(uri), HttpWebRequest)
webRequest.Headers.Add(“SOAP:Action”)
webRequest.ContentType = “application/soap+xml;charset=utf-8”
webRequest.Accept = “text/xml”
webRequest.Method = method
Return webRequest
End Function

And the following sentences

Dim stream As Stream = request.GetRequestStream()
Using (stream)
xmlRequest.Save(stream)
End Using

Dim response As WebResponse = request.GetResponse()
Using (response)
Dim rd As StreamReader = New StreamReader(response.GetResponseStream())
Using (rd)
Dim soapResultStr As String = rd.ReadToEnd()
Dim soapResultXML As XmlDocument = XMLHelper.ConvertStringToDocument(soapResultStr)
result = XMLHelper.GetRespuestaRecepcion(soapResultXML)
End Using
End Using

Most of that looks like Xojo code already.
Have you tried anything yet?

One thing to point out:
Using is meant to save typing.
If Xojo did it, you could do this…

Dim p as picture p = newpicture (200,200) using p.graphics .forecolor = &cFFFF00 .drawstring "Hello",30,50 end using

In the VB code, the using is not actually being used.

Using (rd) // this line is pointless because Dim soapResultStr As String = rd.ReadToEnd() //this line includes the rd anyway

Once you have the response, you create an XML object then call .loadxml to take the string and turn it into an XML structure you can search