NicoLaan
asked on
XmlDocument protocol violation
Having problems translating VB6 to VB.NET (Visual Studio 2005)
Error: "The server committed a protocol violation"
Tried it with 2 different URL's same as in original code.
One works, the other doesn't.
For security reasons I can't give the exact URL but this is what the failed URL looks like:
http://notwww.someprovider.com/long_security_key/sub_folder/page_without_extension?FORMAT=XML&PARM1=0%23.AA.BB
The succesful URL only differs in page_without_extension and parameters, the key and such are the same.
innerText and innerXML is filled with sensible data for the succesful page.
When I try the bad URL in IE, firefox or VB6 it does work.
VB6
Set m_xmlChain = New DOMDocument30
m_xmlChain.resolveExternal s = False
m_xmlChain.validateOnParse = False
m_xmlChain.async = True
m_Done = False
m_xmlChain.Load URLSTRING
While Not m_Done
DoEvents
Wend
Private Sub m_xmlChain_onreadystatecha nge()
If m_xmlChain.readyState = 4 Then
m_Done = True
End If
End Sub
VB.NET
m_xmlChain = New XmlDocument
'm_xmlChain.resolveExterna ls = False ' my attempt to translate this line is in next 3 lines
Dim resolver As New XmlUrlResolver()
resolver.Credentials = CredentialCache.DefaultCre dentials
m_xmlChain.XmlResolver = resolver
'm_xmlChain.validateOnPars e = False ' how to translate?
'm_xmlChain.async = True ' how to translate?
Try
m_xmlChain.Load(URLSTRING)
Catch ex As Exception
messagebox.show(ex.tostrin g)
End Try
Any comments and improvements to the code are welcome, I'm new to this XML stuff in VB.NET. Only played a little with it in javascript.
Follow up Q:
https://www.experts-exchange.com/questions/21921874/Modify-and-re-parse-bad-XML-data.html
Kind regards,
Nico
Error: "The server committed a protocol violation"
Tried it with 2 different URL's same as in original code.
One works, the other doesn't.
For security reasons I can't give the exact URL but this is what the failed URL looks like:
http://notwww.someprovider.com/long_security_key/sub_folder/page_without_extension?FORMAT=XML&PARM1=0%23.AA.BB
The succesful URL only differs in page_without_extension and parameters, the key and such are the same.
innerText and innerXML is filled with sensible data for the succesful page.
When I try the bad URL in IE, firefox or VB6 it does work.
VB6
Set m_xmlChain = New DOMDocument30
m_xmlChain.resolveExternal
m_xmlChain.validateOnParse
m_xmlChain.async = True
m_Done = False
m_xmlChain.Load URLSTRING
While Not m_Done
DoEvents
Wend
Private Sub m_xmlChain_onreadystatecha
If m_xmlChain.readyState = 4 Then
m_Done = True
End If
End Sub
VB.NET
m_xmlChain = New XmlDocument
'm_xmlChain.resolveExterna
Dim resolver As New XmlUrlResolver()
resolver.Credentials = CredentialCache.DefaultCre
m_xmlChain.XmlResolver = resolver
'm_xmlChain.validateOnPars
'm_xmlChain.async = True ' how to translate?
Try
m_xmlChain.Load(URLSTRING)
Catch ex As Exception
messagebox.show(ex.tostrin
End Try
Any comments and improvements to the code are welcome, I'm new to this XML stuff in VB.NET. Only played a little with it in javascript.
Follow up Q:
https://www.experts-exchange.com/questions/21921874/Modify-and-re-parse-bad-XML-data.html
Kind regards,
Nico
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It was the crlf you mentioned. The xml only had 0A my hexeditor told me.
Thanks a lot!