how to fix protocol violation in c#

Posted by Jeremy Styers on Stack Overflow See other posts from Stack Overflow or by Jeremy Styers
Published on 2012-06-09T01:32:44Z Indexed on 2012/06/09 4:40 UTC
Read the original article Hit count: 232

Filed under:
|
|
|

I have a c# "client" and a Java "server". The java server has a wsdl it serves to the client. So far it works for c# to make a request for the server to perform a soap action. My server gets the soap request executes the method and tries to return the result back to the client.

When I send the response to c# however, I get "The server committed a protocol violation. Section=ResponseStatusLine".

I have spent all day trying to fix this and have come up with nothing that works. If I explain what i did, this post would be very long, so I'll keep it brief.

i Googled for hours and everything tells me my "response line" is correct. I tried shutting down Skype, rearranging the response line, adding things, taking things away, etc, etc. All to no avail.

This is for a class assignment so no, I can not use apis to help. I must do everything manually on the server side. That means parsing by hand, creating the soap response and the http response by hand. Just thought you'd like to know that before you say to use something that does it for me.

I even tried making sure my server was sending the correct header by creating a java client that "mimicked" the c# one so I could see what the server returned. However, it's returning exactly what i told it to send.

I tried telling my java client to do the same thing but to an actuall running c# service, to see what a real service returns, and it returned basically the same thing. To be safe, I copied it's response and tried sending it to the c# client and it still threw the error.

Can anyone help? I've tried all i can think of, including adding the useUnsafeHeaderParsing to my app config. Nothing is working though. I send it exactly what a real service sends it and it yells at me. I send it what i want and it yells.

I'm sending this:

"200 OK HTTP/1.0\r\n" +
"Content-Length: 201\r\n" +
"Cache-Control: private\r\n" +
"Content-Type: text/xml; charset=utf-8\r\n\r\n";

© Stack Overflow or respective owner

Related posts about c#

Related posts about java