I'm currently trying to fix my SOAP-Client in C#, but got somehow stuck with the Transfer-Encoding. I'm more or less a newbie to C#, so it's completly possible that im just missing something minor here.
I consumed a SOAP service from our local Tomcat Server following this: https://web.archive.org/web/20180506023052/http://www.csharptutorial.in/37/csharp-net-how-to-consume-a-web-service-in-csharp-net-visual-studio-2010
My current code:
using System;
using ConsoleApp1.Lims;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
LimsZugriffService client = new LimsZugriffService();
// FunktionsErgebnis response = client.connect();
// Console.WriteLine("Connect" + response.meldung);
String[] bond = new String[] { "versuch.auftrag.nr=2014/0031" };
String[] bondFail = new String[] { "abc" };
VersuchsschrittErgebnis reponseVersuch = client.ermittleVersuchsschritte(bond);
Console.WriteLine(reponseVersuch.ermittelteVersuchsschritte.Length);
Console.WriteLine(reponseVersuch.meldung);
}
}
}
After some testing I found out, that something does not work as intended. My Response-Array of <ermittelteVersuchsschritte>
seems to be empty, while the "control"-Flags are parsed normally.
I captured the traffic between client and server to figure out what was wrong and it was actually completly there. Just chunked into 8192 Byte blocks.
Could it be, that the C# implementation of the WebClient got some problems with Transfer-Encoding: Chunked
?
After googling for some hours i could not find a satisfiying solution to this issue. I hope somebody, who knows C# and WebServices better than me has the answer.
For the sake of completeness:
My WSDL
After some researching, trial and error and much time I finally figured out my mistake.
C# seems not to have a problem with the Transfer-Encoding: Chunked
The mistake was on the service side. The consumed wsdl
was generated from java code with the help of Axis
(the first Axis
not Axis2
). Axis generated a wsdl 1.0
while C# seems to expect wsdl 2.0
. So in the end, the XML-structure described in the wsdl
was flawed and could not be automatically consumed.
We fixed this problem by switching from Axis
to Apache CXF
. The newly generated wsdl
was than consumed without a problem at our C# - client side.