Posts

Showing posts with the label WEBSERVICES

Why ASMX-Style WebReferences to WCF Services Don’t serialize Numbers

  Based on a casual googling of this problem, it appears that some developers have spent days trying to figure out why an integer they set on the generated proxy field comes over the wire into the actual WCF service as ZERO.  I didn’t spend days figuring it out, but it certainly did cause no end of annoyance and cursing until I  did. Let’s say you have a WCF service and for one reason or another (maybe your app is on a Handheld device and you cannot use “Add Service Reference”) you’ve set an ASMX – style “Add Web Reference”.  Your code in the generated proxy Reference.cs class may look like this:   public int Quantity {             get {                 return this.quantityField;             }          ...

Silverlight 2 Beta 2: ConfigUnrecognizedElement issue and Fix

  When you create a Service Reference in a Silverlight App to an ASMX WebService, you may get the:  "An unhanded exception ('Sys.InvalidOperationException: ManagedRuntimeError error #4004 in control 'Xaml1': System.InvalidOperationException: ConfigUnrecognizedElement at System.ServiceModel.Configuration.BindingsSection.ReadXml(XmlReader reader)" Exception. This "is a real bug".  When your Visual Studio 2008 Silverlight app generates the ServiceReferences.ClientConfig file, it creates a customBinding section that it cannot parse. In fact even the IDE marks the customBinding tag with squiggles saying "The element 'bindings' has invalid child element 'customBinding'. List of possible elements expected: 'basicHttpBinding'." This is because SIlverlight doesn't understand SOAP 1.2, which is the default for ASMX webservices. DUH! To fix, you can do this with WCF: <customBinding> <binding name=...