We have a big performance issue with the deserialization of base64 string in a WCF Client (C#) which is calling a web service to get PDF files. This service is a third party service not in .NET.
Server side, each PDF file is returned by the third party service as a base64 string. This base64 string is "formatted" in the returned SOAP envelope with carriage return + line feed (CRLF) every 73 characters. The third party provides a wsdl + XSD to described his service.
Client side, in the DataContract generated from the XSD, the DataMember (named "img") containing the returned PDF is declared as "byte" (which is logic). But we noticed that at runtime, once a message arrives, a lot of time is spent client side in the "WCF Soap Stack" before getting the PDF.
So we did some tests and discovered that after changing client side the DataMember "img" from "byte" to "string" (+ doing a Convert.FromBase64String() on "img"), the performance is incredibly improved (it depends on the size of the PDF).
We did next create a WCF Service to emulate the third party service. To send the very same data as the third party, we did save a soap body received from this third party into a XML file (response.xml) and we loaded + deserialized this one in our service.
In this service, we did f
View Complete Post