I am using a traditional C# web service client generated in VS2008 .Net 3.5, inheriting from SoapHttpClientProtocol. This is connecting to a remote web service written in Java.
All configuration is done in code during client initialization, and can be seen below:
ServicePointManager.Expect100Continue = false;
ServicePointManager.DefaultConnectionLimit = 10;
var client = new APIService
{
EnableDecompression = true,
Url = _url + "?guid=" + Guid.NewGuid(),
Credentials = new NetworkCredential(user, password, null),
PreAuthenticate = true,
Timeout = 5000 // 5 sec
};
It all works fine, but the time taken to execute the simplest method call is almost double the network ping time. Whereas a Java test client takes roughly the same as the network ping time:
C# client ~ 550ms
Java client ~ 340ms
Network ping ~ 300ms
After analyzing the TCP traffic for a session discovered the following:
Basically, the C# client sent TCP packets in the following sequence.
Client Send HTTP Headers in one packet.
Client Waits For TCP ACK from server.
Client Sends HTTP Body in one packet.
Client Waits For TCP ACK from server.
The Java client sent TCP packets in the following sequence.
Client Sends HTTP Headers in one packet.
Client Sends HTTP Body in one packet.
Client Revieves ACK for first packet.
Client Revieves ACK for second packet.
Client Revieves ACK for second packet.
Is there anyway to configure the C# web service client to send the header/body in parallel as the Java client appears to?
Any help or pointers much appreciated.
Thanks for the reply Rob, eventually I opted to use the Add Service Reference / WCF proxy generation, which does this by default. Probably because it's using newer HTTP libraries underneath.
I did have a few WCF proxy generation issues with SOAP methods that return raw arrays of complex objects (i.e.: returning an object that contains an array of objects worked fine). To get round this you either have to wrap your arrays in objects, or switch the SOAP server config from RPC to DOCUMENT (which is what we did).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With