Deserialize XML File

  • Thread starter Thread starter Sriranjan
  • Start date Start date
S

Sriranjan

Hi,

How do I deserialize an object based on a random XML file? I have tried

using the XMLSerializer.Deserialize method but it does not set the
values for the members. I need tto do this because I am trying to
invooke a web service by passing this object as the input.


Here is the sample XML file which I am trying to deserialize:


- <ItemSearch xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SubscriptionId>1VCN8RB15QCDW22CGY82</SubscriptionId>
<AssociateTag>aTag</AssociateTag>
<AWSAccessKeyId>accesskey</AWSAccessKeyId>
<MarketplaceDomain>market</MarketplaceDomain>
<Request />
<Shared />
<Validate>invalidate</Validate>
<XMLEscaping>escaped</XMLEscaping>
</ItemSearch>


Thanks,
Sri
 
Sriranjan,
Maybe it's late, but I'm getting that you may be doing this backwards. An
XmlDocument already represents a deserialized object.

If a webservice conforms to standards, you should be able to create a
webservice proxy class by adding a WebReference pointing to the WSDL contract
generated by the service. If the XMLDocument doesn't exactly match the proxy
class representing this object, you can always XPath-out the fields you need.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top