我有
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Xml,
RequestFormat = WebMessageFormat.Xml,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "projects/{projectname}")]
[return: MessageParameter(Name = "ProjectId")]
Guid CreateProject(String projectName);
但这仍然返回
<guid
xmlns="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-00000000</guid>
如何用 ProjectId 替换“guid”?
public Guid CreateProject(String projectName)
{
return Guid.Empty;
}
如果我将 OperationContract BodyStyle 更改为WrappedResponse
我得到:
<CreateProjectResponse
xmlns="http://tempuri.org/">
<ProjectId>00000000-0000-0000-0000-000000000</ProjectId>
</CreateProjectResponse>
这几乎是我想要的,但我不想不必要地包装。