System.Runtime.Serialization.ExtensionDataObject

Topics: Service Factory Modeling Edition Forum
Feb 19, 2008 at 3:53 PM
hello,

I am using WS-SF v3 for the first time. I have been following Hand-on-lab for the service factory Modeling edition.
When i try to call the service from my client i get errors and upon debugging i figure out

public System.Runtime.Serialization.ExtensionDataObject ExtensionData
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}

>> ExtentionDataField is null and i end up with errors.

This is in proxy class. Its generated code and i have little knowledge about how to handle this error. I tried looking for a solution ended up here http://msdn2.microsoft.com/en-us/library/ms733832(printer).aspx but i dont get most of the things in that article.

Can somebody point me in the right direction and tell me how to call the service code from the client application. Use hands-on-lab classes and details.

Hands on Lab a great resourse but can certainly become the greatest just by providing the last missing piece of how-to-call the service from the client application without a problem.

Thanks
Developer
Feb 19, 2008 at 4:43 PM
Can you specify which hands-on lab (Building or Entensibility) are you using and the Exercise number?
By your description, you are using the DataContractSerializer (WCF technology).
Feb 19, 2008 at 5:09 PM
Edited Feb 19, 2008 at 5:12 PM

I am using HOL for Building web-services. I am using the Modeling edition for service software factory.
- Yes - you are absolutely right i am using WCF technolgy and DataContractSerializer.
I am just following the HOL exercises and tried the WCF implementation but cant seem to make it work with the client.
I am using VS-2005 with the Modeling edition.
Developer
Feb 19, 2008 at 8:02 PM
You should not set any special value in this field (as you pointed in your reference, is used for versioning the DC).
Check if you have in your DC fields, the setting "IsRequired" as true. In that case, try setting to false.
Feb 20, 2008 at 5:31 AM
I have tested another datacontract with datamembers setting IsRequired set to false. But when i generate proxy it still adds
public System.Runtime.Serialization.ExtensionDataObject ExtensionData properties in the proxy code.

A simple DC with only one Datamember in the defination still ends up including the above mentioned property in its defination when a proxy is generated for it. I dont know wether its the default behavior or its required.

Every Type in DC that is converted into proxy code from the DC contains the above mentioned property defination. I dont completely understand the use for it and i am not setting any special values in this field. But when i try to pass parameters using some type this property get part tries to return but fail when it encouters a null.

This is what i have done till now
1- Followed the HOL for Modeling Edition for creation of a WCF service
2- tried the below mention code for accessing the service in a client application. I used the test client application that gets generated in the solution with the main form.

//-Code-
MaterialMgmtProxy.PartsMgntServiceContractClient proxy = new MaterialMgmtProxy.PartsMgntServiceContractClient();

PartLevel Pl = new PartLevel();
Pl.IncomingLevel = 10;
Pl.OnhandLevel = 90;

DemandRequest req = new DemandRequest();
AirCraftPart part = new AirCraftPart();
req.AirCraftPart = part;
req.AirCraftPart.Part = "Abc";
Vendor ven = new Vendor();
req.AirCraftPart.PreferredVendor = ven;
req.AirCraftPart.PreferredVendor.Address = "x";
req.Date = DateTime.Now;
Pl = proxy.GetRequiredDemand(req);


  1. error generated at the last line#
========================
System.ServiceModel.CommunicationException was unhandled
Message="The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error."
Source="mscorlib"
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at 0:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at BYA.Mfg.SCM.Svc.WCF.Client.MaterialMgmtProxy.PartsMgntServiceContract.GetRequiredDemand(DemandRequest1 request)
at BYA.Mfg.SCM.Svc.WCF.Client.MaterialMgmtProxy.PartsMgntServiceContractClient.BYA.Mfg.SCM.Svc.WCF.Client.MaterialMgmtProxy.PartsMgntServiceContract.GetRequiredDemand(DemandRequest1 request) in F:\VS 2005 Projects\Win_forms\BlueYonderAirlines\BYA.Mfg.SCM.Svc.WCF\Tests\BYA.Mfg.SCM.Svc.WCF.Client\Service References\MaterialMgmtProxy.cs:line 453
at BYA.Mfg.SCM.Svc.WCF.Client.MaterialMgmtProxy.PartsMgntServiceContractClient.GetRequiredDemand(DemandRequest DemandRequest) in F:\VS 2005 Projects\Win_forms\BlueYonderAirlines\BYA.Mfg.SCM.Svc.WCF\Tests\BYA.Mfg.SCM.Svc.WCF.Client\Service References\MaterialMgmtProxy.cs:line 460
at BYA.Mfg.SCM.Svc.WCF.Client.MainForm.ExecuteButtonClick(Object sender, EventArgs e) in F:\VS 2005 Projects\Winforms\BlueYonderAirlines\BYA.Mfg.SCM.Svc.WCF\Tests\BYA.Mfg.SCM.Svc.WCF.Client\MainForm.cs:line 41
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at BYA.Mfg.SCM.Svc.WCF.Client.Program.Main() in F:\VS 2005 Projects\Win_forms\BlueYonderAirlines\BYA.Mfg.SCM.Svc.WCF\Tests\BYA.Mfg.SCM.Svc.WCF.Client\Program.cs:line 16
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Feb 20, 2008 at 9:47 AM

I re-run the whole HOL exercises and ended up identifying my mistake. The names of files in service contract project and service implementation projects were causing the strange behavior.

Thanks for the help ... CharlyFriend