我XML看起來像:傳遞的IEnumerable <int>作爲參數傳遞給WCF服務
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>1</item>
<item>2</item>
<item>3</item>
</items>
而且一個WCF服務合同:
[ServiceContract(Namespace = "", Name = "MyService", SessionMode = SessionMode.NotAllowed)]
public interface IMyService
{
[OperationContract]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
void DoWork(IEnumerable<int> items);
}
服務綁定是基本的HTTP。 但是當我嘗試張貼XML來WCF方法我收到提示: Unable to deserialize XML message with root name "items" and root namespace ""
應該如何WCF方法模樣正確與XML的工作嗎?
嘗試讓你的服務的WSDL。合同模式是否與您的XML匹配? – Aphelion
@MauriceStam出於同樣的原因在問題http://stackoverflow.com/questions/21127021/add-behaviorattribute-to-a-workflowservicehost我無法看到wsdl。我只需要使服務瞭解我提供的xml格式 – Sergio