I have a problem and I can't get out of it. My knowledge about WebServices isn't great and I have a little problem that I need to solve. I'm developing a client for the web service and I have no power over the server side web service (and I think it is developed in Java). I used WSE3 to base my client on and it seems working pretty fine, except for a couple of methods, which I can’t solve. Based on my WSDL definition I generated my proxy classes, whit proper data types and methods to call. Many of these methods return already deserialized SOAP messages, casted to the proper object type. Unfortunately some of them send back a byte array of a ZIP file, containing a not well formatted xml file inside. I managed to get the stream, unzip the file and read the xml, but I can’t deserialize properly the xml and then cast it on a respective type. This is an example of my code, and an example of the xml that I need to deserialize and cast to proper 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 an List<> of 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.M.B.H.</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 B.V.</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’m unable to deserialize it and cast it to the proper object type. I tried many approaches but I was unsuccessful. Perhaps you have any suggestion?
Thanks