I use web service calls and using the WCF service link on the client. I saved the XML responses received from the test service to disk (without SOAP envelope and body tags). I would like to load them from disk and create objects from them. Lets use the following method from my web service:
SomeMethodResponse SomeMethod(SomeMethodRequest req)
I manually (via SOAP UI) save the response to the disk in a file, Example response:
<SomeMethodResponse xmlns="http://myNamespace">
<SomeMember1>value</SomeMember1>
</SomeMethodResponse>
Then I try to deserialize the object from the file using:
DataContractSerializer dcs =
new DataContractSerializer(typeof(SomeMethodResponse))
This fails - the serializer complains about the error that it expects an element in the namespace http://schemas.datacontract.org/2004/07 ', but found the element in' http: // myNamespace '.
: DataContractSerializer , SomeMethodResponseType XmlTypeAttribute(Namespace="http://myNamespace")?
, DataContractSerializer. , :
X Y ( XML-). 'EndElement' 'SomeMethodResponse
'httpmyNapespace .
"someNameField".
SomeName - XSD, -. SomeMethodResponse, someNameField. , DataContractSerializer .
XML, , , SomeMethod?
, Matra