|
|
|
date: Mon, 31 Mar 2008 04:40:01 -0700,
group: microsoft.public.xml
back
Re: simple xml de-serializer test
Hi,
I got a parse error "Parse Error, no assembly associated with Xml key _P1
GetResultResponse" with this code:
using System.Xml;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Soap;
IFormatter formatter;
FileStream fileStream = null;
Object objectFromSoap = null;
try
{
string filePath = @"C:\FileStore\Result.xml";
fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
formatter = new SoapFormatter();
objectFromSoap = formatter.Deserialize(fileStream); <-- error
Console.Write(objectFromSoap.ToString());
Console.ReadLine();
}
Any advice ?
cheers
Andrew
"Andrew" wrote:
> Hi,
>
> Thanks for your reply. From what I've read, the code is different for SOAP
> Serialization, but for de-serialization, it's essentially the same. Am I
> right ?
>
> What I need to figure out is which is the SoapType, XMLRoot, XmlType, etc
> tags...
>
> cheers
> Andrew
>
> "Martin Honnen" wrote:
>
> > Andrew wrote:
> >
> > > I modified the code to deserialize a larger xml file which goes something
> > > like this:
> > > Is the code the same to de-serialize ?
> > >
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > > <soap:Body>
> > > <GetResultResponse xmlns="http://Product/Books/Store/V2">
> > > <InvestigationReport>
> > > <ReportData xmlns="http://Product/Books/Store">
> > > <ServiceProvider />
> > > <RequestingParty>
> > > <HcpId xmlns="http://Product/Books/General">
> > > <IdValue>ABC001</IdValue>
> > > <IdScheme>Requestor</IdScheme>
> > > <IdType>Administrator</IdType>
> > > </HcpId>
> > > </DocumentData>
> > > </InvestigationReport>
> > > </GetResultResponse>
> > > </soap:Body>
> > > </soap:Envelope>
> >
> > That is SOAP so you might want to look into SOAP serialization
> > <URL:http://msdn2.microsoft.com/en-us/library/564k8ys4(VS.80).aspx>
> >
> >
> > --
> >
> > Martin Honnen --- MVP XML
> > http://JavaScript.FAQTs.com/
> >
date: Tue, 1 Apr 2008 01:58:01 -0700
author: Andrew
|
|