c# - Problem passing object between WCF and ASMX using DataContracts -


I am trying to use ASMX / WCF to pass an object between sites (public / private). I can get a serialized object from my public WCF service from my personal ASMX service, but I can not destrate the object. [WebGet (UriTemplate = "{part}")] Public Distributor GetDistributorInventory (string part)

makes a personal ASMX service call. ) {Const String url = "http://www.site.com/service/lookup.asmx/StockCheck?part=" + Part; // This is a wrapper for HttpWebRequest that returns string string results = WebHelper.HttpRequest ("GET", "text / xml", null, url, new cookie constantner); Byte [] Bytere = Encoding. ASCII.GetBytes (Results); Memorystream stream = new memorystream (byte); Data contractoriserialize desreialize = new data contractorilizer (typed (distributor)); Return (Distributor) deserialize.ReadObject (stream); }

Agreement used in both public / private services

  [DataContract (namespace = "http://www.site.com/Services/", Name = "inventory")] Public category list {{Datamember (order = 1)) Receive public string MPN; Set; } [DataMember (Order = 2)] Get Public String Datasheet URL { Set; } [Datamember (order = 3)] Public listing & lt; Distributor & gt; Stock {received; Set; }} [DataContract (namespace = "http://www.site.com/Services/", name = "distributor")] public class distributor {[datamember (order = 1)) public string name {get; Set; } [Datamember (order = 2)] public string part {get; Set; } [Datamember (order = 3)] {Receive public amounts; Set; } [DataMember (order = 4)] Public string URL {get; Set; }}   

Error message:

Error in line 1 position 166. 'Element' in the name of 'inventory', named 'http://www.site.com/services/'. '.

I may be going completely wrong about this, therefore suggesting better sampling (with sample) greatly appreciate my end goal to pass things between WCF & amp; amp; is; WCF or ASMX services using custom objects and data contrects.

It seems that trying to deserialize it as distributor But it is refunding stockcancer call a inventory .

Comments