www.webdeveloper.com
Results 1 to 4 of 4

Thread: ASP.NET VB SOAP Help - Newbie needs help parsing SOAP

Hybrid View

  1. #1
    Join Date
    Dec 2004
    Location
    Kansas City, Missouri
    Posts
    31

    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

  2. #2
    Join Date
    Nov 2012
    Location
    America
    Posts
    5
    I don't quite understand

  3. #3
    Join Date
    Dec 2012
    Posts
    5
    Yes, a little bit confusing. Let me check it on the internet.....wait...

  4. #4
    Join Date
    Dec 2004
    Location
    Kansas City, Missouri
    Posts
    31

    resolved Resolved

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles