有一個php應用程序將從我創建的web服務讀取結果。 他們希望XML響應就像將響應結果作爲數組而不是網絡服務中的對象
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<WorkResponse xmlns="http://tempuri.org/">
<WorkResult>Name<WorkResult>
<WorkResult>Occupation<WorkResult>
</WorkResult>
</WorkResponse>
</s:Body>
但我的方法是這樣`
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<WorkResponse xmlns="http://tempuri.org/">
<WorkResult xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:string>Name</a:string>
<a:string>Occupation</a:string>
</WorkResult>
</WorkResponse>
</s:Body>`
及以下的回報是我寫在Web服務的方法
public string[] Work()
{
string[] request = new String[2];
request[0] = "Name";
request[1] = "Occupation";
return request;
}
哪有我確實得到了他們想要的結果。 請幫我走出這個問題
你試過我的回答嗎? –
我正在使用wcf服務 – vithushan