I am programming a WindowsPhone application using SOAP based WebService using WCF. I have a problem that something with parsing does not work, how it should work. There is a generated class (Reference.cs) created by the visual studio based on the wsdl service description. If I call the servicemethod and there is no error, everything is fine, the request is sent, and I get a response. But if something went wrong, the request is sent, and the server returns an error object. This object is called "ClientException" and is specified in the wsdl file. The problem is that the code does not receive the return value (error) and cannot return an exception. Concrete base.EndInvoke () fails. This seems to be a problem with winphone / silverlight tested using a regular wcf client, there are no problems with the service and / or parsing.
Here is some code to show what I mean:
Code from Reference.cs
public IAsyncResult BegingetCubeState(AsyncCallback callback, object asyncState)
{
object[] _args = new object[0];
IAsyncResult _result = base.BeginInvoke("getCubeState", _args, callback, asyncState);
return _result;
}
public CubeState EndgetCubeState(IAsyncResult result)
{
object[] _args = new object[0];
Debugger.Break();
CubeState _result = ((CubeState)(base.EndInvoke("getCubeState", _args, result)));
return _result;
}
base.EndInvoke ("getMaxCubeState", _args, result) fails
InvalidCastException
bei System.ServiceModel.Dispatcher.XmlSerializerObjectSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName)
bei System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlReader reader, Boolean verifyObjectName)
bei System.Runtime.Serialization.XmlObjectSerializer.InternalReadObject(XmlReaderDelegator reader, Boolean verifyObjectName)
bei System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName)
bei System.Runtime.Serialization.XmlObjectSerializer.ReadObject(XmlDictionaryReader reader)
bei System.ServiceModel.Dispatcher.XmlSerializerFaultFormatter.CreateFaultException(MessageFault messageFault, String action)
bei System.ServiceModel.Dispatcher.FaultFormatter.Deserialize(MessageFault messageFault, String action)
bei System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
bei System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
bei System.ServiceModel.ClientBase1.ChannelBase1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
bei WindowsPhoneStr.ServiceReferenceSoap.RemoteClient.RemoteClientChannel.EndgetCubeState(IAsyncResult result)
bei WindowsPhoneStr.ServiceReferenceSoap.RemoteClient.WindowsPhoneStr.ServiceReferenceSoap.IRemote.EndgetCubeState(IAsyncResult result)
bei WindowsPhoneStr.ServiceReferenceSoap.RemoteClient.OnEndgetCubeState(IAsyncResult result)
bei System.ServiceModel.ClientBase1.OnAsyncCallCompleted(IAsyncResult result)
bei System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)
bei System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously, Exception exception)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.CallComplete(Boolean completedSynchronously, Exception exception)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.FinishSend(IAsyncResult result, Boolean completedSynchronously)
bei System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.SendCallback(IAsyncResult result)
bei System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously)
bei System.ServiceModel.AsyncResult.Complete(Boolean completedSynchronously, Exception exception)
bei System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnGetResponse(IAsyncResult result)
bei System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2)
bei System.Threading.ThreadPool.WorkItem.doWork(Object o)
bei System.Threading.Timer.ring()
I hope I have explained the problem in detail. Is there a solution to solve this problem?
Thank you for your time!