我需要从传入我的服务的消息中提取soap标头属性。我正在使用服务堆栈,并且一直在四处寻找,但在任何地方都找不到一个好的答案。谁能告诉我如何从请求对象中检索SOAP标头属性?
这是我的服务
public class NotificationServices : Service
{
public GetAccountNotificationResponse Any (GetAccountNotification request)
{
//Do Some stuff Here!!!
//Need to retrieve some header here
}
}任何帮助都将不胜感激。如果你知道这是不可能的,也请让我知道。
谢谢
发布于 2013-06-10 14:49:44
在最新版本的ServiceStack v3.9.49中,您可以使用IHttpRequest.GetSoapMessage()扩展方法访问请求SOAP消息(对于SOAP请求),例如:
public class NotificationServices : Service
{
public GetAccountNotificationResponse Any (GetAccountNotification request)
{
//Do Some stuff Here!!!
var requestSoapMessage = base.Request.GetSoapMessage();
}
}从Serialization / Deserialization wiki
在使用IHttpRequest.GetSoapMessage()扩展方法访问您的服务中的SOAP端点时,您可以访问原始的WCF消息,例如:
Message requestMsg = base.Request.GetSoapMessage();要告诉ServiceStack完全跳过对SOAP请求的反序列化,请将IRequiresSoapMessage接口添加到请求DTO中,例如:
public class RawWcfMessage : IRequiresSoapMessage {
public Message Message { get; set; }
}
public object Post(RawWcfMessage request) {
request.Message... //Raw WCF SOAP Message
}https://stackoverflow.com/questions/17017074
复制相似问题