ASP.NET VB SOAP Help - Newbie needs help parsing SOAP
Hello,
I've been searching for help on how to accomplish this with limited success so I hope that someone here can guide me or point me in the right direction.
I apologize in advance if I misuse terms since I'm new to this.
Coding in Text-Pad with VB (Can't get Visual Studio Express to download, but probably won't help in time allotted since I don't know the IDE)
Third party company will be sending me an HTTP POST with SOAP content.
1) Anyone know of a really, really basic tutorial/walk-through on retrieving the XML/SOAP from the POST Body and parsing it? MSDN has not been friendly to me today.
2) Is this possible to accomplish without 'code-behind'?
3) Am I even moving in the right direction with the following code?
Code:
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Serialization" %>
<%
Dim pgRequest As System.Net.HttpWebRequest
Dim pgResponse As System.Net.HttpWebResponse
Dim pgURL = Request.Url
'Log File Setup
Dim FILENAME as String = "mylog_" & DateTime.Now.ToString("yyyyMMdd") & ".log"
Dim objFileStream as FileStream
Dim asyncResult As IAsyncResult
Dim writeBuffer As Byte()
Dim logText As String = (DateTime.Now.ToString("yyyyMMdd HHmmss")) & " URL=" & pgURL.ToString
objFileStream = New FileStream(FILENAME,FileMode.Append,FileAccess.Write,Fileshare.ReadWrite,4096,True)
Using objStreamWriter As StreamWriter = New StreamWriter(objFileStream)
writeBuffer = Encoding.ASCII.GetBytes(logText)
asyncResult = objFileStream.BeginWrite(writeBuffer,0,writeBuffer.Length,Nothing,Nothing)
objStreamWriter.WriteLine()
objFileStream.EndWrite(asyncResult)
objFileStream.Flush()
objStreamWriter.Flush()
objStreamWriter.Close()
End Using
objFileStream.Close()
Dim input As Stream = HttpContext.Current.Request.InputStream
Dim reader As StreamReader = New StreamReader(input)
Dim instance As XmlSerializer
Dim returnVal As Object = New Object()
returnVal = instance.Deserialize(input)
%>
Thus, I get lost at the Object portion which is why I am a newbie in need of a tutorial that my Friday afternoon, caffeine deprived brain can comprehend.
Bless anyone who can take pity on me today!
Thanks,
~Maria
We're Tiny,
We're Toony,
We're all a little loony.
The scripts were rejected;
Expect the Unexpected.
I apologize for the confusion. I was trying to load an XML/SOAP Document from a Request Stream. Being new to the process, I wasn't sure how to do this.
I ended up with:
Code:
Dim input As Stream = HttpContext.Current.Request.InputStream
Dim xmlReader As XmlTextReader = New XmlTextReader(input)
xmlReader.WhitespaceHandling = WhitespaceHandling.None
xmlReader.Read()
Dim xmlDoc As XmlDocument = new XmlDocument()
xmlDoc.Load(xmlReader)
From there, I was able to use MSDN to figure out how to traverse the XML and find the values that I needed. It may not be the most efficient way, but it works.
We're Tiny,
We're Toony,
We're all a little loony.
The scripts were rejected;
Expect the Unexpected.
Bookmarks