I need to create a web-service that will integrate information from SAP within my organization. I have an existing application with a database structure. SAP will use the web-service to store values into the relevant tables/columns in the database.
For this, I need to provide the SAP team with an Xml schema that will be used to pass the data. Now, I do not know a lot about xml. What I did is I created Dto's based on the Entity Framework classes of all the relavent tables. This includes 8 different classes:
RFQ is the base class
and it can contain either an RFQGoods or an RFQServices.
Next, I attempted using the xsd.exe tool to generate a schema, but received this result:
Error: There was an error processing 'RfqService.dll'.
- There was an error reflecting type 'RfqService.DataTransferObjects.RfqDto'.
- Cannot serialize member 'RfqService.DataTransferObjects.RfqDto.RFQGoods' of
type 'System.Collections.Generic.ICollection1[[RfqService.DataTransferObjects.RfqGoodDto, RfqService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]', see inner exception for more details. - Cannot serialize member RfqService.DataTransferObjects.RfqDto.RFQGoods of type System.Collections.Generic.ICollection
1[[RfqService.DataTransferObjects.RfqGoodDto, RfqService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]] because it is an interface.
I think what I need is the correct xml attributes
for the classes and each of their parameters
, but I do not know what attributes I need to add to make this work and haven't been able to find out. Below is the RfqDto class:
[DataContract]
public class RfqDto
{
[DataMember]
public int RfqId { get; set; }
[DataMember]
public bool IsAbove30k { get; set; }
[DataMember]
public string ReferenceNumber { get; set; }
[DataMember]
public string ContactPersonName { get; set; }
[DataMember]
public string ContactPersonTelephoneNumber { get; set; }
[DataMember]
public string ContactPersonCellPhone { get; set; }
[DataMember]
public string BuyerName { get; set; }
[DataMember]
public string BuyerTelephoneNumber { get; set; }
[DataMember]
public string BuyerEmailAddress { get; set; }
[DataMember]
public Nullable<int> QuotationBoxNumber { get; set; }
[DataMember]
public Nullable<int> FloorNumber { get; set; }
[DataMember]
public virtual ProcurementItemDto ProcurementItem { get; set; }
[DataMember]
public virtual ICollection<RfqGoodDto> RfqGoods { get; set; }
[DataMember]
public virtual ICollection<RfqServiceDto> RfqServices { get; set; }
}