I'm having a strange issue - I saw a similar post on this forum, but it didn't have an answer.
Long story short, I am sending an HttpWebRequest using C# to a web service (stubs were created by adding a web reference in Visual Studio 2008, .NET 2.0) which breaks with the following message: "Unable to parse the incoming request". This is a java based webservice running on weblogic.
Here is the strange part, if I have fiddler running to monitor my request - IT WORKS FINE!!??
My theory is that fiddler is reformatting the request in some manner which the server likes?
Does anyone know what .NET could be doing to the request which fiddler could be fixing?
If not, is there a way I can view my XML programmatically without using fiddler?
Caveat - I do not have access to make changes to the server hosting the web service.
Thanks,
Steve
UPDATE - When I remove the "Decrypt HTTPS traffic" option in fiddler it no longer works. So whatever fiddler is doing to decrypt the HTTPS traffic is what is making this work....
Use Wireshark to see what's going on at the network packet level - that's as definitive as it gets!
(One caveat, which I think is true for Steve but might not be for other readers: this assumes your web service is on a different machine, so that there is some physical network activity to monitor - Wireshark won't help if it's all running on your local machine.)
Steve,
I had exactly the same symptoms when I was debugging web proxy I was developing. It turned out that Fiddler was correcting the CRLF (\r\n) chars that go after the last byte of last header and before first byte of request body. According to HTTP spec, there should be exactly two CRLFs and my proxy was adding three of them there (due to a bug) and Fiddler was silently correcting this.
Not sure if this is the same problem in your case, as you are using proxies, but maybe it will help you somehow.
Related
I'm accessing Dynamics 365 Business Central OData API in C# application, and when accessing data in my local system is good and when we deployed the application to client server, randomly (50%) they are getting the error "The server committed a protocol violation. Section=ResponseStatusLine".
I have checked the article https://techcommunity.microsoft.com/t5/iis-support-blog/protocol-violation-section-responsestatusline/ba-p/1227792 and applied all the 3 suggestions, but none of them worked.
I'm able to access the client Business Central API integration application in my local system without any issues.
Assuming that this is client Firewall or load balancer issue. But not able to find the solution.
There are many case behind this issue, avoiding the problem rather than actually fixing it. One of the most common cause of this error is the corrupt or missing headers in the request.
Solution:
The server responds with a 100 continue in an incorrect way. Setting expect 100 continue to false and reducing the socket idle time to two seconds
HttpRequestObj.ServicePoint.Expect100Continue = false;
HttpRequestObj.ServicePoint.MaxServicePointIdleTime = 2000;
Ignore corrupted/missing headers. Ref: Link
Stop skype if it is running on the machine.
If a webserver uses UTF-8 that outputs the byte-order-marker (BOM). For example, the default constant Encoding.UTF8 outputs the BOM, and it is easy to forget this. The webpages will work correctly in Firefox and Chrome but HttpWebRequest will bomb. A quick fix is to change the webserver to use the UTF-8 encoding that doesn't output the BOM.
Check the end point of your request server. ex:https or http.
I want to send a put request with some json strings to a server some time in the future. I want to compare the request Im sending to the requirements I have been given, but I do not have access to that server yet so I cant test if the request Im sending is looking the way it should. The only thing I found would be ToString'ing my httpWebRequest (like in this), which is not what I need.
Is there a way to read exactly what I'm sending after (or before) I send it into the void? Or alternatively, is there a way to send a request to myself and read it that way?
Edit: I cannot install foreign software on my workstation. While using a tool like Wireshark probably solves the answer for the general public, I still need a way to do this programmatically.
Edit2: Searching for the topic may have not resulted in anything, but a random topic on the right that SO suggested actually has (almost exactly) what I wanted and all it takes is copy pasting something into the web.config file. Implementing this answer puts (amongst other things) all the connections as well as their contents into the debug console.
Try using an HTTP debugging tool like Fiddler. It acts like a proxy and can let you view the request and response of HTTP requests your program sends.
Here's how to use it with HttpWebRequest: Get HTTP requests and responses made using HttpWebRequest/HttpWebResponse to show in Fiddler
If you aren't allowed to install Fiddler you could think about making your own version of Fiddler in c# to capture traffic How to create a simple proxy in C#?
I get this error with my .Net app but it only occurs on chrome on 2 pages on my site and only on my network.
What does the notes in the image mean? If I hit refresh it works fine. How do I figure out what the headers are and if it's a network or security thing?
Clear your cookies. This must be caused by an invalid cookie. Had the same issue and clearing the cookies worked for me
Followings can be possible options to look at:
As you getting issues in Chrome, clear cache/cookies
Error 400: The Web server thinks that the data stream sent by the client (e.g.
your Web browser) was 'malformed' i.e. did
not respect the HTTP protocol completely. So the Web server was
unable to understand the request and process it.
It indicates that the two systems (our robot and the Web server)
fundamentally disagree on the syntax of HTTP data streams. Mare sure you are not calling HTTPS from HTTP?
Hope this helps!
I am implementing the client-side of a ms webservice and i would like to see the exact http call that is made. i.e. all the parameters and how they are encoded.
I tried sniffing it with wireshark, but since it seems it is done via https i can see the data.
I am running this client straight out of visual studio. is there a way to see the data there?
Teletic Fiddler is great tool to debug any http communication. http://www.telerik.com/fiddler. I can show request and response information in raw views, xml, JSON etc
It can even inspect https traffic. Follow this guide.
There is a similar question here.
I have a project where I have created web service proxy classes with wsdl.exe and then simply create an instance of that class (inherits System.Web.Services.Protocols.SoapHttpClientProtocol) and call the method that should send a SOAP message. I'm using Visual Studio 2008 if that matters. And I'm trying this in my development machine without access to actual web service that is located inside of customer's intranet. So, the sending will of course not succeed and I will not get any response back but all I would like to see is the exact content of SOAP messages this solution creates and tries to send. How do I see that?
Use fiddler.
Have a look at SOAPUI from eviware.com.
Its a free for personal use Java app. Among other things you can
set it up to run as a dummy test server. Just load up hte WSDL
and enter the dummy data.
In test server mode it will log your requests so you can see whats happening
inside the request message.
If you're Web service is accessed by clear text, non-SSL HTTP, you can just use a sniffer, like Wireshark, to see the data coming from and to your application. Wireshark can trace, filter and analyze wire data. I have used it do debug HTTP and other protocols many times, and it's a great tool to do this.
SOAP messages are simply XML data sent using the HTTP POST method. So you can for example install a local web server on your development machine, configure your web service to use some dummy URI on this server, and grab the network traffic with WireShark (AKA ethereal). The big advantage of this method is that it involves no coding.
Alternatively you can use an HTTP echo server that dumps its incoming traffic, like this one (found while googling "http echo server"):
You can intercept the call with tcpMon