I'm looking to remove certain elements from a HTTPWebRequest
I have attached the elements I need to remove in an image (elements are coloured red):
I've tried:
System.Net.ServicePointManager.Expect100Continue = False
for one of the elements but to no avail I've also tried:
webRequest.Headers.Remove(HttpRequestHeader.Connection)
Any help would be really appreciated.
here is my code:
Dim content As blah.Content = New blah.Content
Dim inputguid As String = Guid.NewGuid.ToString
Dim service As blah.WebService = New blah.WebService
Dim str As New System.Xml.XmlDocument
Dim payload As blah.Payload = New blah.Payload
System.Net.ServicePointManager.Expect100Continue = False
'payload
str.LoadXml(xmlstr)
'manifest
service.payloadManifest = New blah.PayloadManifest
service.payloadManifest.manifest = New blah.Manifest() {New blah.Manifest}
service.payloadManifest.manifest(0).element = "GetVehicleServiceHistory"
service.payloadManifest.manifest(0).namespaceURI = "http://www.starstandards.org/STAR"
service.payloadManifest.manifest(0).contentID = "Content0"
service.payloadManifest.manifest(0).version = "2.01"
service.SoapVersion = SoapProtocolVersion.Soap11
service.UserAgent = "VendorName"
payload.content = New blah.Content() {content}
ReDim Preserve payload.content(0)
payload.content(0).Any = str.DocumentElement
payload.content(0).id = "Content0"
service.Timeout = -1
service.Url = "http://localhost:8080"
service.ProcessMessage(payload)
and then within the reference.vb of my webservice:
Protected Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest
Dim webRequest As HttpWebRequest = DirectCast(MyBase.GetWebRequest(uri), HttpWebRequest)
Dim sp As ServicePoint
sp = ServicePointManager.FindServicePoint(New Uri(Me.Url))
sp.ConnectionLeaseTimeout = 0
webRequest.Headers.Remove(HttpRequestHeader.Connection)
webRequest.KeepAlive = False
webRequest.Timeout = 100000
webRequest.ReadWriteTimeout = 100000
Return webRequest
End Function