0
返回WCF REST服务当我运行从浏览器我的WCF REST方法当在XML元素的前我接收 一个:中的XML元素的前面在浏览器返回WCF REST服务时?任何人都知道这一点,并知道它为什么会发生?我期待格式化元素的<a:在浏览器
<?xml version="1.0"?>
<GetProductNameListResponse xmlns="TheBigContract">
<GetProductNameListResult xmlns:i="http://www.w3.org/2001/XMLSchemaintance" xmlns:a="http://schemas.datacontract.org/2004/07/ProductDTO">
<a:Product>
<a:Company i:nil="true"/>
<a:DayOfWeek i:nil="true"/>
<a:Location i:nil="true"/>
<a:TimeOfDay i:nil="true"/>
<a:TruckID>0</a:TruckID>
<a:TruckName>BBQ Smith</a:TruckName>
<a:Website>test</a:Website>
</a:Product>
<a:Product>
<a:Company i:nil="true"/>
<a:DayOfWeek i:nil="true"/>
<a:Location i:nil="true"/>
<a:TimeOfDay i:nil="true"/>
<a:TruckID>0</a:TruckID>
<a:TruckName>Bon Me</a:TruckName>
<a:Website>test</a:Website>
</a:Product>
那么你说如果我有一个独特的命名空间,那么我不会看到一个:?谢谢。 – midnightCoder 2012-04-05 16:12:04
是的,它可以是这种情况,但它依赖于XML序列化程序,如果它使用默认命名空间或显式使用命名空间。 – 2012-04-05 16:23:44
在你的情况下,我不认为你可以下到一个命名空间,因为你有像公司这样的“可空”属性,必须在soap中使用XmlSchemaInstance命名空间中的'nil =“true”'来定义。 – 2012-04-05 16:31:46