IIS中如何配置一个插件,让Soap消息到达Web Service之前被该插件截获

navyliusheng 2006-11-07 10:36:32
大家好,请教大家一个问题,IIS中如何配置一个插件,让Soap消息到达Web Service之前被该插件截获,就像WSE3.0 中的Customer UserNameTokenManager一样。这样我可在IIS中做很多工作,比如加密解密,安全认证等。
...全文
264 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
rosanshao 2006-11-18
  • 打赏
  • 举报
回复
这个很简单啊,解析Request.就可以得到
HttpApplication app = (HttpApplication)source;
HttpContext context = app.Context;
Stream HttpStream = context.Request.InputStream;
long posStream = HttpStream.Position;
if (context.Request.ServerVariables="HTTP_SOAPACTION"] == null)
return;
XmlDocument dom = new XmlDocument();
string soapUser; string soapPassword;
try
{ dom.Load(HttpStream);
HttpStream.Position = posStream;
soapUser=dom.GetElementsByTagName("User").Item(0).InnerText;
soapPassword =dom.GetElementsByTagName("Password").Item(0).InnerText;
}
catch (Exception e)
{
HttpStream.Position = posStream;
XmlQualifiedName name = new
XmlQualifiedName("Load");
SoapException soapException = new SoapException(
"Unable to read SOAP request", name, e);
throw soapException;
}


navyliusheng 2006-11-08
  • 打赏
  • 举报
回复
谢谢 hdt,我已经利用HttpModule截获了Http的信息,但是问一个弱弱的问题,如何从HttpApplication对象中获取SoapMessage呢?我找了半天没有找到相关的属性,还请赐教!!
真相重于对错 2006-11-07
  • 打赏
  • 举报
回复
or
httphandler
真相重于对错 2006-11-07
  • 打赏
  • 举报
回复
httpmodule
navyliusheng 2006-11-07
  • 打赏
  • 举报
回复
hi,老兄,你能否给我一个关键词,在MSDN里面怎么找阿?
谢谢!
真相重于对错 2006-11-07
  • 打赏
  • 举报
回复
ms-help://MS.MSDNQTR.2003FEB.2052/cpguide/html/cpconhttpmodules.htm
真相重于对错 2006-11-07
  • 打赏
  • 举报
回复
HttpHandler , HttpModule 和isapi基本类似,要简单多了
navyliusheng 2006-11-07
  • 打赏
  • 举报
回复
我在网上找了,好像ISAPI可以实现,不过ISAPI只能用C或者C++ 来编程,不能用C#。
不知道ISAPI是不是已经过时的技术,我找到的文章都好老。

12,163

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧