I've been working with a host of different OFX financial services to retrieve data from remote servers and merge them into one of my client's systems. These servers are a wide variety of different Web Servers and using various versions of the OFX protocols which has been nothing short of a nightmare to deal with.
One thing that I've run in with several servers however are pure HTTP problems which apparently are caused by the server application returning invalid results. Specifically 'The server has committed a protocol violation'.
One service specifically kept failing in this fashion and initially I had no way to figure out WTF is wrong. I actually went as far and fired up my trusty WinInet test client app to check this out and sure enough the request worked just fine. Even more confusing is the fact that the server on the other end is IIS 5 and is apparently serving stock IIS headers with its result - yet every attempt to access it with the .NET WebRequest would fail.
Apparently the problem is that starting with .NET 1.1 SP2 the HTTP protocol usage has been made more strict and any issApparently the problem is that starting with .NET 1.1 SP2 the HTTP protocol usage has been made more strict and any issue ue in the HTTP headers - such as returning only a CR intead of CRLF pair at the end of a header - apparently throws the header for a loop.
The solution is to set a configuration flag to disable this strict handling in the configuration file.
<?xml version="1.0"?>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
<defaultProxy>
<proxy bypassonlocal="True" usesystemdefault="False" />
</defaultProxy>
</system.net>
</configuration>
This has fixed up the issue with his particular server (which is probably masquerading as an IIS server rather than really running it - IIS 5 doesn't natively generate invalid headers <s>) and I was able to get on with live.
Unfortunately though it looks like this Config flag is required to change this value in the application as there is no corrsponding property on the actual WebRequest object or the ServicePoint (which is responsible for many of the low level request settings) for that matter.
Other Posts you might also like