Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27311

VS 2010 Check WebResponse Status

$
0
0
I am attempting to submit some SOAP and receive a response back. I have been able to handle catching all of the errors that could occur. However I can't figure out how to parse the data that comes back when the status is 200(a successful attempt) My code for submission is below along with the exception handler. Can someone point me in the right direction for parsing the response data?
Code:

' Get the request stream.
        Dim dataStream As Stream = request.GetRequestStream()
        ' Write the data to the request stream.
        dataStream.Write(byteArray, 0, byteArray.Length)
        ' Close the Stream object.
        dataStream.Close()


        ' Get the response.
        Dim response As WebResponse
        Try
            response = request.GetResponse()

        Catch ex As WebException
            Using errorResponse = ex.Response
                If errorResponse IsNot Nothing Then
                    Using errorReader As New StreamReader(errorResponse.GetResponseStream())
                        ReturnedData = errorReader.ReadToEnd()
                        PMResponse(ReturnedData, "orderID")
                    End Using
                End If
            End Using
            Return
        End Try


Viewing all articles
Browse latest Browse all 27311

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>