我只需要在 WCF 消息中签署一个特定字段。该类具有下一个方面:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]
[System.ServiceModel.MessageContractAttribute(WrapperName="simpleInputData",
ProtectionLevel = ProtectionLevel.None
, IsWrapped=true)]
public partial class SimpleOperationRequest
{
[System.ServiceModel.MessageHeaderAttribute(
ProtectionLevel = ProtectionLevel.None)]
public BusinessHeader businessHeader;
[System.ServiceModel.MessageHeaderAttribute(
ProtectionLevel = ProtectionLevel.None)]
public TechnicalHeader technicalHeader;
[System.ServiceModel.MessageBodyMemberAttribute(
ProtectionLevel = ProtectionLevel.Sign, Order = 0)]
public SimpleInput simpleInput;
[System.ServiceModel.MessageBodyMemberAttribute(
ProtectionLevel = ProtectionLevel.None, Order = 1)]
public Attachment attachment;
[...]
}
如您所见,我只需要 sign simpleInput 字段,但是,当我运行代码时,发送的包是(仅显示正文节点):
[...]
<s:Body u:Id="_3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<simpleInputData xmlns="http://xxxx/simple">
<simpleInput>
<in>llega?</in>
</simpleInput>
<attachment>
<ImageData>iVBORw0K...5CYII=</ImageData>
</attachment>
</simpleInputData>
</s:Body>
[...]
在代码中,可以看到整个body节点都被签名了。
我怎样才能只获得节点“simpleInput”签名?
提前非常感谢!