Web service problems : lost data

Aug 13, 2010 at 10:26 AM

Hello everybody,

I'm working on a Silverlight 4 project consumming a web service that I've developped and wich is hosted on IIS 7.

I've done 2 tests :
- the first, including the service as a project in my project test reference ;
- the second, developping a small client wich consume the service.

My problem concerns an object, wich we'll call Container, that I've developped and which contains some pieces of information about a picture (for my tests, I use JPG pictures).
My Container contains only fields typed string, int, double, bool, char, short, ushort, byte and some tables of these last types.

To resume, I've a container object filled out of my method using the reference and container object empty out of my method consuming the web service hosted on IIS.

I've got an other problem, when I consumed the web service, this exception was thrown :
 [CommunicationException] "The server did not return the expected answer."

The exact error message is :
 The server did not respond * relevant, this may be caused by contracts that do not match, a premature termination of the session or an internal server error.

And this is the stack trace :

Server stack trace:
   à System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   à System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   à System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
   à System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   à System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   à WebServiceModelConsummer.MyService.IService1.GetImage(String objectID, Int32 index)
   à WebServiceModelConsummer.MyService.Service1Client.GetImage(String objectID, Int32 index) dans C:\Documents and Settings\JuicyLink\Mes documents\Visual Studio 2010\Projects\WebServiceModelConsummer\WebServiceModelConsummer\Service References\MyService\Reference.cs:ligne 3713
   à WebServiceModelConsummer.TestsConsoleMyService.GetImage(MyObject object) dans C:\Documents and Settings\JuicyLink\Mes documents\Visual Studio 2010\Projects\WebServiceModelConsummer\WebServiceModelConsummer\Form1.cs:ligne 666
   à WebServiceModelConsummer.TestsConsoleMyService.btnGetImage_Click(Object sender, EventArgs e) dans C:\Documents and Settings\JuicyLink\Mes documents\Visual Studio 2010\Projects\WebServiceModelConsummer\WebServiceModelConsummer\Form1.cs:ligne 855
   à System.Windows.Forms.Control.OnClick(EventArgs e)
   à System.Windows.Forms.Button.OnClick(EventArgs e)
   à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   à System.Windows.Forms.Control.WndProc(Message& m)
   à System.Windows.Forms.ButtonBase.WndProc(Message& m)
   à System.Windows.Forms.Button.WndProc(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   à System.Windows.Forms.Application.Run(Form mainForm)
   à WebServiceModelConsummer.Program.Main() dans C:\Documents and Settings\JuicyLink\Mes documents\Visual Studio 2010\Projects\WebServiceModelConsummer\WebServiceModelConsummer\Program.cs:ligne 18
   à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   à System.Threading.ThreadHelper.ThreadStart()


At this time, I know the cause of the problem : in my container object, I've Byte, short and Ushort tables that I've called respectively ByteBuffer, ShortBuffer et UshortBuffer.
This is those 3 fields of my object wich are the cause of my problem : if I set them the null value, it works, else, it doesn't.

So the question is : Is any problem known about the table of Byte, Short and Ushort stocked in an exposed object (these fields was exposed too) and wich could throw a CommunicationException ?

Hope that could help you to help me to solve my problem.