Click here to Skip to main content
15,936,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
All,
Anyone see an issue here? I am getting "The remote server returned an error: (500) Internal Server Error." -> Debug window: A first chance exception of type 'System.Net.WebException' occurred in System.dll

I can run the SOAP request using SOAPUI and the response and data returns without an issue.

Here is the code...not sure if someone wants to see the wsdl file or not..
Any help is appreciated...

Private Const syncServer As String = "https://<servername>/smsxml/SystemManagementService.php"......<pre lang="vb">Function sendRequest_List_Vector()
      'Handels SSL Certificate
      Dim oCertOverride As New CertificateOverride
      ServicePointManager.ServerCertificateValidationCallback = AddressOf oCertOverride.RemoteCertificateValidationCallback
      Dim webRequest As HttpWebRequest = TryCast(Net.WebRequest.Create(syncServer), HttpWebRequest)
      Dim webResponse As HttpWebResponse
      Dim strEnvelope As String
      Dim myvalue As Integer = 1
      Dim tempCookies As New CookieContainer

      'SOAP Request
      strEnvelope = "" & Chr(34) & "<?xml version=""1.0"" encoding=""utf-8""?>" & _
        "<SOAP-ENV:Envelope xmlns:SOAP-ENV=" & Chr(34) & "http://schemas.xmlsoap.org/soap/envelope/" & Chr(34) & " xmlns:ns1=" & Chr(34) & "http://xml.avaya.com/ws/session" & Chr(34) & " xmlns:ns2=" & Chr(34) & "http://xml.avaya.com/ws/SystemManagementService/2008/07/01"">" & _
        "<SOAP-ENV:Header>" & _
        "<ses:sessionID><ses:sessionID/>" & _
        "</SOAP-ENV:Header>" & _
        "<SOAP-ENV:Body>" & _
        "<ns2:submitRequest>" & _
        "<modelFields>" & _
        "<Vector>" & _
        "</Vector>" & _
        "</modelFields>" & _
        "<operation>list</operation>" & _
        "<objectname></objectname>" & _
        "<qualifier></qualifier>" & _
        "</ns2:submitRequest>" & _
        "</SOAP-ENV:Body>" & _
        "</SOAP-ENV:Envelope>"
      Debug.Print(strEnvelope)
      With webRequest
          .CookieContainer = tempCookies
          .Credentials = New NetworkCredential("username", "password")
          .ContentType = "application/soap+xml;  charset=utf-8"
          .Headers.Add("SOAPAction", "http://xml.avaya.com/ws/SystemManagementService/2008/07/01#soap_webservice#submitRequest")
          .ContentLength = strEnvelope.Length
          .Method = "POST"
          .Accept = "text/xml"
          .Referer = "https://<servername>/smsxml/SystemManagementService.php"
          .UserAgent = " Jakarta Commons-HttpClient/3.1"
          .KeepAlive = False
          .Timeout = 60 * 1000 ' milliseconds to seconds


          Dim streamWriter As New IO.StreamWriter(.GetRequestStream())
          streamWriter.Write(strEnvelope)
          streamWriter.Close()
          webResponse = CType(.GetResponse(), HttpWebResponse)

      End With
      Dim stream As IO.Stream = webResponse.GetResponseStream
      Dim streamReader As New IO.StreamReader(stream, Encoding.UTF8)
      Dim xmlStream As String = streamReader.ReadToEnd
      streamReader.Close()
      stream.Close()
      Debug.Print(xmlStream)
      Return xmlStream



  End Function</servername>

Posted
Comments
Simon_Whale 28-Jul-11 10:44am    
at what point does the error happen?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900