xml deserialization not working with soap xml .net -


i have following soap xml

<?xml version="1.0"?> <soap:envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingstyle="http://www.w3.org/2001/12/soap-encoding" xmlns:xsd="http://www.w3.org/1999/xmlschema" xmlns:xsi="http://www.w3.org/1999/xmlschema-instance" xmlns:m="http://xxx.xxx/soap-encoding/tester/"> <soap:body> <m:eventinst xmlns="http://xxx.xxx/soap-encoding/tester/eventinst" soap:id="123"> <m:occurances soap:href="3553||3" /> <m:subject xsi:type="xsd:string">subject value</m:subject> <m:stateref xsi:type="xsd:string">1234</m:stateref> <m:type xsi:type="xsd:string">abc</m:type> <m:message xsi:type="xsd:string"> message</m:message> </m:eventinst> </soap:body> </soap:envelope> 

i using xml content , getting respective xml classes in vs using option edit-paste special -> paste xml classes. class generated , trying deserialize xml using class giving values occurances . other fields subject ,stateref type null.

 var serializer = new xmlserializer(typeof(envelope));         var buffer = encoding.utf8.getbytes(resources.xml);         using (var stream = new memorystream(buffer))         {             var objectxml= (envelope)serializer.deserialize(stream);          } 

can me out please. envelope model :

'''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://www.w3.org/2001/12/soap-envelope"), _  system.xml.serialization.xmlrootattribute([namespace]:="http://www.w3.org/2001/12/soap-envelope", isnullable:=false)> _ partial public class envelope      private bodyfield envelopebody      private encodingstylefield string      '''<remarks/>     public property body() envelopebody                     return me.bodyfield         end         set(value envelopebody)             me.bodyfield = value         end set     end property      '''<remarks/>     <system.xml.serialization.xmlattributeattribute(form:=system.xml.schema.xmlschemaform.qualified)> _     public property encodingstyle() string                     return me.encodingstylefield         end         set(value string)             me.encodingstylefield = value         end set     end property end class  '''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://www.w3.org/2001/12/soap-envelope")> _ partial public class envelopebody      private eventinstfield eventinst      '''<remarks/>     <system.xml.serialization.xmlelementattribute([namespace]:="http://xxx.xxx/soap-encoding/tester/")> _     public property eventinst() eventinst                     return me.eventinstfield         end         set(value eventinst)             me.eventinstfield = value         end set     end property end class  '''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://xxx.xxx/soap-encoding/tester/"), _  system.xml.serialization.xmlrootattribute([namespace]:="http://xxx.xxx/soap-encoding/tester/", isnullable:=false)> _ partial public class eventinst      private occurancesfield eventinstoccurances      private subjectfield eventinstsubject      private statereffield eventinststateref      private typefield eventinsttype      private messagefield eventinstmessage      private idfield byte      '''<remarks/>     public property occurances() eventinstoccurances                     return me.occurancesfield         end         set(value eventinstoccurances)             me.occurancesfield = value         end set     end property      '''<remarks/>     public property subject() eventinstsubject                     return me.subjectfield         end         set(value eventinstsubject)             me.subjectfield = value         end set     end property      '''<remarks/>     public property stateref() eventinststateref                     return me.statereffield         end         set(value eventinststateref)             me.statereffield = value         end set     end property      '''<remarks/>     public property type() eventinsttype                     return me.typefield         end         set(value eventinsttype)             me.typefield = value         end set     end property      '''<remarks/>     public property message() eventinstmessage                     return me.messagefield         end         set(value eventinstmessage)             me.messagefield = value         end set     end property      '''<remarks/>     <system.xml.serialization.xmlattributeattribute(form:=system.xml.schema.xmlschemaform.qualified, [namespace]:="http://www.w3.org/2001/12/soap-envelope")> _     public property id() byte                     return me.idfield         end         set(value byte)             me.idfield = value         end set     end property end class  '''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://xxx.xxx/soap-encoding/tester/")> _ partial public class eventinstoccurances      private hreffield string      '''<remarks/>     <system.xml.serialization.xmlattributeattribute(form:=system.xml.schema.xmlschemaform.qualified, [namespace]:="http://www.w3.org/2001/12/soap-envelope")> _     public property href() string                     return me.hreffield         end         set(value string)             me.hreffield = value         end set     end property end class  '''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://xxx.xxx/soap-encoding/tester/")> _ partial public class eventinstsubject      private typefield string      private valuefield string      '''<remarks/>     <system.xml.serialization.xmlattributeattribute(form:=system.xml.schema.xmlschemaform.qualified, [namespace]:="http://www.w3.org/1999/xmlschema-instance")> _     public property type() string                     return me.typefield         end         set(value string)             me.typefield = value         end set     end property      '''<remarks/>     <system.xml.serialization.xmltextattribute()> _     public property value() string                     return me.valuefield         end         set(value string)             me.valuefield = value         end set     end property end class  '''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://xxx.xxx/soap-encoding/tester/")> _ partial public class eventinststateref      private typefield string      private valuefield ushort      '''<remarks/>     <system.xml.serialization.xmlattributeattribute(form:=system.xml.schema.xmlschemaform.qualified, [namespace]:="http://www.w3.org/1999/xmlschema-instance")> _     public property type() string                     return me.typefield         end         set(value string)             me.typefield = value         end set     end property      '''<remarks/>     <system.xml.serialization.xmltextattribute()> _     public property value() ushort                     return me.valuefield         end         set(value ushort)             me.valuefield = value         end set     end property end class  '''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://xxx.xxx/soap-encoding/tester/")> _ partial public class eventinsttype      private typefield string      private valuefield string      '''<remarks/>     <system.xml.serialization.xmlattributeattribute(form:=system.xml.schema.xmlschemaform.qualified, [namespace]:="http://www.w3.org/1999/xmlschema-instance")> _     public property type() string                     return me.typefield         end         set(value string)             me.typefield = value         end set     end property      '''<remarks/>     <system.xml.serialization.xmltextattribute()> _     public property value() string                     return me.valuefield         end         set(value string)             me.valuefield = value         end set     end property end class  '''<remarks/> <system.xml.serialization.xmltypeattribute(anonymoustype:=true, [namespace]:="http://xxx.xxx/soap-encoding/tester/")> _ partial public class eventinstmessage      private typefield string      private valuefield string      '''<remarks/>     <system.xml.serialization.xmlattributeattribute(form:=system.xml.schema.xmlschemaform.qualified, [namespace]:="http://www.w3.org/1999/xmlschema-instance")> _     public property type() string                     return me.typefield         end         set(value string)             me.typefield = value         end set     end property      '''<remarks/>     <system.xml.serialization.xmltextattribute()> _     public property value() string                     return me.valuefield         end         set(value string)             me.valuefield = value         end set     end property end class 


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -