I have a problem and I cannot get out of it. My knowledge of WebServices is small, and I have a small problem that I need to solve. I am developing a client for a web service, and I do not have authority over the server side web service (and I think it is developed in Java). I used WSE3 for my client, and it seems to work very well, except for a few methods that I cannot solve. Based on my definition of WSDL, I generated my proxy classes with the correct data types and methods to call. Many of these methods return already deserialized SOAP messages that are discarded to the appropriate object type. Unfortunately, some of them send back a byte array of a ZIP file containing an unformatted XML file inside it. I managed to get the stream, unzip the file and read the xml, but I can not deserialize the XML file and then apply it to the appropriate type. This is an example of my code and an example xml that I need to deserialize and apply to the appropriate type. Do you have any suggestions?
MyClient client = new MyClient(ServiceSettings); ConnectResponseRetrieveMyType data; try { // call web service method data = client.syncData(service, startDate, endDate); // unzip the byte array using (ZipFile zip = ZipFile.Read(data.Data)) { if (zip.ContainsEntry("data.xml")) { List<string> strings = new List<string>(); // read the xml file with multiple root elements XmlReaderSettings settings = new XmlReaderSettings(); settings.ConformanceLevel = ConformanceLevel.Fragment; using (XmlReader reader = XmlReader.Create(zip["data.xml"].OpenReader(), settings)) { while (reader.Read()) { strings.Add(reader.ReadOuterXml()); } } } else return "OGZIP01"; } }
At the end, I have a List <> string containing this data:
<c:CoverDecision TypeOfCover="CreditLimit" CoverId="123123123" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c="http://atradius.com/connect/_2007_08/" xmlns:o="http://atradius.com/organisation/_2007_08/type/"> <Buyer> <o:Identifier registeredOffice="SYMPH"> <o:id>123123123</o:id> <o:countryTypeIdentifier>AUT</o:countryTypeIdentifier> </o:Identifier> <o:Identifier registeredOffice="COC"> <o:id>123123123F</o:id> <o:countryTypeIdentifier>AUT</o:countryTypeIdentifier> </o:Identifier> <o:Name> <o:name>SOME GES.MBH</o:name> <o:type>REG</o:type> </o:Name> <o:LegalForm>GMBH</o:LegalForm> <o:Address> <o:StreetDescription xsi:type="xsd:string">STRAßE 49</o:StreetDescription> <o:City>FÜRSTENFELD</o:City> <o:PostCode>23123</o:PostCode> <o:CountryISOCode>AUT</o:CountryISOCode> </o:Address> </Buyer> <Customer> <o:Identifier registeredOffice="SYMPH"> <o:id>123123</o:id> <o:countryTypeIdentifier>NLD</o:countryTypeIdentifier> </o:Identifier> <o:Identifier registeredOffice="COC"> <o:id>123123</o:id> <o:countryTypeIdentifier>NLD</o:countryTypeIdentifier> </o:Identifier> <o:Name> <o:name>SOME BV</o:name> <o:type>REG</o:type> </o:Name> </Customer> <PolicyId>123123</PolicyId> <GenericApplication> <CustomerReference>123123</CustomerReference> <EntryDate>2010-02-04</EntryDate> <Supersede>false</Supersede> </GenericApplication> <Decision> <ApplicationResult>CreditLimitDecision</ApplicationResult> <DecisionDate>2010-02-05</DecisionDate> <EffectFrom>2010-02-05</EffectFrom> <EffectTo>2010-07-19</EffectTo> <CreditLimitDecision> <CreditLimitResultCode>APPR</CreditLimitResultCode> <DecisionCode>DC16</DecisionCode> <FirstAmount> <Amount>150000.00</Amount> <Conditions> <TypeOfConditions>ADMIN</TypeOfConditions> <ConditionCode>T310</ConditionCode> <ConditionText>Some condition description text.</ConditionText> </Conditions> </FirstAmount> <SecondAmount> <Amount>0</Amount> </SecondAmount> </CreditLimitDecision> </Decision> </c:CoverDecision>
And I was not able to deserialize it and apply it to the corresponding type of object. I tried many approaches, but I was unsuccessful. Do you have any suggestions?
thanks
user586254
source share