Probably I'm the problem, need to work less.
First I tried to deserialize it in a standard way:
XmlSerializer serializer = new XmlSerializer(typeof(CoverDecisionType));
CoverDecisionType a = CoverDecisionType)serializer.Deserialize(reader);
And I was getting InvalidOperationException ({"There is an error in XML document (1, 2)."}
{"<CoverDecision xmlns='http://atradius.com/connect/_2007_08/'> was not expected."})
Why I tried this? This we service has a couple of methods. Many of these methods replay with CoverDecisionType, but not this one, this one replays with an byte array that is a zip file, containing an xml file with a multiple root elements. Each of these elements should be CoverDecisionType object. CoverDecisionType object was defined by WSE3 basing the proxy on WSDL.
But, right now, analyzing the trace info of the methods that returns CoverDecisionType, I see that the XML contained into the SOAP message body differs with the code that I listed.
As I'm not an XML expert, I would like to know if it is possible to deserialize this XML into the same CoverDecisionType object. If not, what should be the best way to proceed?
The CoverDecisionType definition is (partial):
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://atradius.com/connect/_2007_08/")]
public partial class CoverDecisionType
{
private string externalCoverIdField
private OrganisationType buyerField
private BasicOrganisationType customerField
private long policyIdField
private BasicRequestSummaryType itemField
private ItemChoiceType itemElementNameField
private DecisionType decisionField
private long coverIdField
private CoverType typeOfCoverField
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string ExternalCoverId
{
get
{
return this.externalCoverIdField
}
set
{
this.externalCoverIdField = value
}
}
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public OrganisationType Buyer
{
get
{
return this.buyerField
}
set
{
this.buyerField = value
}
}
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public BasicOrganisationType Customer
{
get
{
return this.customerField
}
set
{
this.customerField = value
}
}
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public long PolicyId
{
get
{
return this.policyIdField
}
set
{
this.policyIdField = value
}
}
[System.Xml.Serialization.XmlElementAttribute("CreditCheckApplication", typeof(BasicApplicationSummaryType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("CreditLimitApplication", typeof(AmountLimitApplicationSummaryType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("GenericApplication", typeof(BasicRequestSummaryType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("NoRiskOpinionApplication", typeof(AmountLimitApplicationSummaryType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlElementAttribute("SpecialProductApplication", typeof(AmountLimitApplicationSummaryType), Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemElementName")]
public BasicRequestSummaryType Item
{
get
{
return this.itemField
}
set
{
this.itemField = value
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public ItemChoiceType ItemElementName
{
get
{
return this.itemElementNameField
}
set
{
this.itemElementNameField = value
}
}
[System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public DecisionType Decision
{
get
{
return this.decisionField
}
set
{
this.decisionField = value
}
}
[System.Xml.Serialization.XmlAttributeAttribute()]
public long CoverId
{
get
{
return this.coverIdField
}
set
{
this.coverIdField = value
}
}
[System.Xml.Serialization.XmlAttributeAttribute()]
public CoverType TypeOfCover
{
get
{
return this.typeOfCoverField
}
set
{
this.typeOfCoverField = value
}
}
}
and the soap message that is correctly deserialized is:
<soapenv:body xmlns:soapenv="#unknown">
<applyforcreditlimitresponse xmlns="http://atradius.com/connect/_2007_08/">
<coverdecision typeofcover="CreditLimit" coverid="123123">
<buyer>
<ns1:identifier registeredoffice="SYMPH" xmlns:ns1="http://atradius.com/organisation/_2007_08/type/">
<ns1:id>123123</ns1:id>
<ns1:countrytypeidentifier>NLD</ns1:countrytypeidentifier>
</ns1:identifier>
<ns2:identifier registeredoffice="COC" xmlns:ns2="http://atradius.com/organisation/_2007_08/type/">
<ns2:id>12312312312</ns2:id>
<ns2:countrytypeidentifier>NLD</ns2:countrytypeidentifier>
</ns2:identifier>
<ns3:name xmlns:ns3="http://atradius.com/organisation/_2007_08/type/">
<ns3:name> BEDRIJVENCONTACTDAGAMSTERDAM</ns3:name>
<ns3:type>REG</ns3:type>
</ns3:name>
<ns4:legalform xmlns:ns4="http://atradius.com/organisation/_2007_08/type/">STIC</ns4:legalform>
<ns5:address xmlns:ns5="http://atradius.com/organisation/_2007_08/type/">
<ns5:streetdescription>DE 1081-A</ns5:streetdescription>
<ns5:city>AMSTERDAM</ns5:city>
<ns5:postcode>1081 HV</ns5:postcode>
<ns5:countryisocode>NLD</ns5:countryisocode>
</ns5:address>
</buyer>
<customer>
<ns6:identifier registeredoffice="SYMPH" xmlns:ns6="http://atradius.com/organisation/_2007_08/type/">
<ns6:id>123123123</ns6:id>
<ns6:countrytypeidentifier>NLD</ns6:countrytypeidentifier>
</ns6:identifier>
<ns7:identifier registeredoffice="COC" xmlns:ns7="http://atradius.com/organisation/_2007_08/type/">
<ns7:id>123123123</ns7:id>
<ns7:countrytypeidentifier>NLD</ns7:countrytypeidentifier>
</ns7:identifier>
<ns8:name xmlns:ns8="http://atradius.com/organisation/_2007_08/type/">
<ns8:name>NL B.V.</ns8:name>
<ns8:type>REG</ns8:type>
</ns8:name>
</customer>
<policyid>123123</policyid>
<creditlimitapplication>
<customerreference />
<entrydate>2011-01-20</entrydate>
<supersede>false</supersede>
<requestedamount>10000</requestedamount>
<currencycode>EUR</currencycode>
</creditlimitapplication>
<decision>
<applicationresult>ReferedDecision</applicationresult>
<decisiondate>2011-01-20</decisiondate>
<effectfrom>2011-01-20</effectfrom>
<effectto>4712-12-31</effectto>
<referreddecision xsi:type="ns9:String35" xmlns:ns9="http://atradius.com/organisation/_2007_08/type/" xmlns:xsi="#unknown">REFERRED</referreddecision>
</decision>
</coverdecision>
</applyforcreditlimitresponse>
</soapenv:body>
Any suggestion?
Thanks