Exception calling WCF service from a Spider WCF client: "Parsing Error. Type RaiseResponse must be present"

I appreciate any pointers to resolve this exception. This is my first WCF client on FEZ Spider, the WCF service is running on a PC in a Windows Service. It tested fine using a PC WCF client (I used Add Service Client in the PC version). The service is reachable from the Spider device and HttpWebRequest on the works fine and returns the correct wsdl xml text.

I followed the following steps:

  • Generated the source files using MfSvcUtil from the WSDL file
  • Added two of the three generated files to my project (did not add the xxxHostedService.cs)
  • Added the framework assemblies to References (MFWsStack, MFDpwsExtensions, and MFDpwsClient)
  • Added the following code to call a web service function that returns void, function name is Raise

The last line in this function generates the exception

    void CallWSRaise()
        Uri remoteEndPoint = new Uri("");
        Ws.Services.Binding.HttpTransportBindingConfig config = new Ws.Services.Binding.HttpTransportBindingConfig(remoteEndPoint);         
        Ws.Services.Binding.WS2007HttpBinding binding = new Ws.Services.Binding.WS2007HttpBinding(config);            
        Ws.Services.ProtocolVersion version = new Ws.Services.ProtocolVersion10();

        tempuri.org.IAlarmClientProxy client = new tempuri.org.IAlarmClientProxy(binding, version);            
        schemas.datacontract.org.TSGSCentralLib.Alarm alarm = new schemas.datacontract.org.TSGSCentralLib.Alarm();
        alarm.DeviceId = Guid.NewGuid().ToString();
        alarm.Code = 501;
        tempuri.org.Raise raise = new tempuri.org.Raise();
        raise.alarm = alarm;

Exception System.Xml.XmlException - 0x00000000 (1)

Message: Parsing Error. Type RaiseResponse must be present.

Ws.Services.Serialization.DataContractSerializer::ReadElement [IP: 004e]

Ws.Services.Serialization.DataContractSerializer::IsParentStartElement [IP: 000f]

tempuri.org.RaiseResponseDataContractSerializer::ReadObject [IP: 000a]

tempuri.org.IAlarmClientProxy::Raise [IP: 0066]

SpiderTestBench.Program::CallWSRaise [IP: 0052]

SpiderTestBench.Program::button_ButtonPressed [IP: 0022]

Gadgeteer.Modules.GHIElectronics.Button::OnButtonEvent [IP: 0057]

System.Reflection.MethodBase::Invoke [IP: 0000]

Gadgeteer.Program::DoOperation [IP: 001a]

Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054]

Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a]

Microsoft.SPOT.Dispatcher::Run [IP: 0006]

Gadgeteer.Program::Run [IP: 001d]

A first chance exception of type ‘System.Xml.XmlException’ occurred in MFWsStack.dll

The following PC Client Code (calling the same WCF Service) works fine:

        //Step 1: Create an instance of the WCF proxy.
        AlarmClient client = new AlarmClient();

        // Step 2: Call the service operations.
        // Call the Raise service operation.
        Alarm alarm = new Alarm();
        alarm.DeviceId = Guid.NewGuid();
        alarm.Code = 3;

        //Step 3: Closing the client gracefully closes the connection and cleans up resources.

What are the other properties of your Alarm entity? Does there happen to be any properties of type array or DateTime that are left unassigned or null? That can cause an error during the serialization process.

No other properties, here is the code on the server side for IAlarm interface and Alarm class. I noticed the GUID type conversion to string (on the server side it is defined as GUID but MfSvcUtil generated the type on the client side as string):

namespace TSGSCentralLib
public interface IAlarm
void Raise(Alarm alarm);
void Clear(Alarm alarm);

public class Alarm
    Guid deviceId;
    short code;

    public Guid DeviceId
        get { return deviceId; }
        set { deviceId = value; }

    public short Code
        get { return code; }
        set { code = value; }


And here is the generated code on the client side:

public class Alarm
    [DataMember(Order=0, IsRequired=false)]
    public short Code;
    [DataMember(Order=1, IsRequired=false)]
    public string DeviceId;

Could it be the void return type of the Raise operation, MfSvcUtil generated the below empty class for RaiseResponse and a bunch of other code to read and write the response:

public class RaiseResponse

@ harmouti - It does not seem to be the void return type of the Raise operation, I changed the return type to bool and I still get the same exception.