C# 关于如何将此xml序列化为webservice方法的输入的方法

C# 关于如何将此xml序列化为webservice方法的输入的方法,c#,xml,web-services,serialization,C#,Xml,Web Services,Serialization,我在我的项目中得到了一个webreference,我可以调用所有方法来使用系统返回的数据集中的数据(有时一个数据集中有多个表)。在我的代码中,我没有任何强类型的东西,老实说,这让我觉得有点不走运。我可以使用此Web服务中公开的一些GetAll方法中的数据。我必须调用一些方法来搜索正确的数据,这些方法要求我将xml作为参数发送给方法。这是预期的格式: <?xml version="1.0" encoding="utf-8"?> <ProductSearchCriteria>

我在我的项目中得到了一个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>

生产年龄
-1
-1
生产城市
0
产品编号
140
产品文化名称
2.
Prod_FromDate
2009-11-07T00:00:00
产品包含AXRulesDescriptionText
1.
产品页码
1.
产品页面大小
10
普罗德帕克斯
2.
产品
产品类型
产品类型
生产区
430
普罗迪酒店
0
产品销售渠道ID
2.
产品展示仅适用于以下项目
0
Prod_主演
0
1.
2.
3.
4.
5.
生产商品
2.
生产
2009-11-14T00:00:00
现在,我一直在寻找最好的方法,以便能够在这个Web服务的方法中以参数(字符串)的形式发送这种预期的xml格式,但我似乎找不到一个感觉节省的好的解决方案。我只想构建一个可以进行xml序列化的类(使用不同类型的字典)。
如果有一些好的建议,会很有帮助的

您希望发送/接收的XML是否有模式(XSD)?如果是这样的话,看看“xsd.exe”将为您生成多少类。不幸的是,没有可用的xsd来生成类。