我的项目中有一个webreference,我可以调用的所有方法都使用系统中的数据返回带有信息的数据集(有时一个数据集中有多个表)。在我的代码中,我在这一点上没有任何强有力的类型,说实话有点不走运。我可以使用此Web服务中公开的一些GetAll方法中的数据。我必须调用一些搜索正确数据的方法,我需要将xml作为参数发送给方法。这是预期的格式:
<?xml version="1.0" encoding="utf-8"?>
<ProductSearchCriteria>
<dictionary xmlns="http://dff.com/xml/serialization">
<item>
<key>
<string xmlns="">Prod_Ages</string>
</key>
<value>
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="">
<int>-1</int>
<int>-1</int>
</ArrayOfInt>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_CityId</string>
</key>
<value>
<int xmlns="">0</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_CountryId</string>
</key>
<value>
<int xmlns="">140</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_CultureName</string>
</key>
<value>
<int xmlns="">2</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_FromDate</string>
</key>
<value>
<dateTime xmlns="">2009-11-07T00:00:00</dateTime>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_IncludePaxRulesDescriptionText</string>
</key>
<value>
<int xmlns="">1</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_PageNumber</string>
</key>
<value>
<int xmlns="">1</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_PageSize</string>
</key>
<value>
<int xmlns="">10</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_Pax</string>
</key>
<value>
<int xmlns="">2</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_ProdObjIds</string>
</key>
<value>
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="" />
</value>
</item>
<item>
<key>
<string xmlns="">Prod_ProdObjTypes</string>
</key>
<value>
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="" />
</value>
</item>
<item>
<key>
<string xmlns="">Prod_ProdTypes</string>
</key>
<value>
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="" />
</value>
</item>
<item>
<key>
<string xmlns="">Prod_RegionAreaId</string>
</key>
<value>
<int xmlns="">430</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_ResortId</string>
</key>
<value>
<int xmlns="">0</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_SalesChannelId</string>
</key>
<value>
<int xmlns="">2</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_ShowAvailableProdsOnly</string>
</key>
<value>
<int xmlns="">0</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_StarRating</string>
</key>
<value>
<ArrayOfInt xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="">
<int>0</int>
<int>1</int>
<int>2</int>
<int>3</int>
<int>4</int>
<int>5</int>
</ArrayOfInt>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_ThemeId</string>
</key>
<value>
<int xmlns="">2</int>
</value>
</item>
<item>
<key>
<string xmlns="">Prod_ToDate</string>
</key>
<value>
<dateTime xmlns="">2009-11-14T00:00:00</dateTime>
</value>
</item>
</dictionary>
</ProductSearchCriteria>
现在我一直在寻找能够将此预期的xml格式作为参数(字符串)发送到此Web服务的方法中的最佳方法,但我似乎无法找到一个良好的可靠解决方案保存。我想构建一个我可以xml序列化的类(使用不同类型的字典)。 一些好的建议会有所帮助!