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