WSE 3.0 问题

redfox105 2007-10-29 01:37:33
winform 客户端通过WEB服务(采用WSE3.0,启用了MTOM)获取数据,偶尔会收到:"请求因 HTTP 状态 400 失败: Bad Request。"的错误返回,
同时发现服务器的事件日志里以下的错误:
HTTP/ASMX Message Receive Failure: System.Xml.XmlException: 根级别上的数据无效。 行 2,位置 1。
在 System.Xml.XmlTextReaderImpl.Throw(Exception e)
在 System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
在 System.Xml.XmlTextReaderImpl.Throw(String res)
在 System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
在 System.Xml.XmlTextReaderImpl.ParseDocumentContent()
在 System.Xml.XmlTextReaderImpl.Read()
在 System.Xml.XmlTextReader.Read()
在 Microsoft.Web.Services3.Xml.XmlSkipDTDReader.Read()
在 System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
在 System.Xml.XmlDocument.Load(XmlReader reader)
在 Microsoft.Web.Services3.SoapEnvelope.Load(Stream inStream)
在 Microsoft.Web.Services3.WseProtocol.CreateRequestSoapEnvelope(SoapServerMessage message)
在 Microsoft.Web.Services3.WseProtocol.GetRequestEnvelopeFromMessage(SoapServerMessage message)
查找的很久都不知道是什么问题导致的,估计是启用了MTOM才会这样,不知道谁遇到过这种情况,帮忙看看.

我的WSE3.0配置:
<microsoft.web.services3>
<messaging>
<mtom clientMode="On" serverMode="optional"/>
</messaging>
<security>
<securityTokenManager>
<add type="TorchUsernameTokenManager" namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" localName="UsernameToken"/>
</securityTokenManager>
</security>
<policy fileName="wse3policyCache.config"/>
</microsoft.web.services3>

...全文
230 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
楼申中 2007-12-19
  • 打赏
  • 举报
回复
UP
gyc 2007-12-04
  • 打赏
  • 举报
回复
还有

我服务端这个<mtom clientMode= "On " serverMode= "optional "/ >
后面设置成了 always

我看了官方文档, 如果我要没有理解错误的话, 大概意思是,如果设置成Optional, 请求可以是MTOM 也可以不是,但返回的是MTOM
设置成Always 后,就只能都是MTOM了
gyc 2007-12-04
  • 打赏
  • 举报
回复
这个我也遇到了

原因是客户端没有 WSE类库, 如果,你没有使用MTOM的话,能正常工作,但是用了MTOM就不可以了

引用WSE类库后,在重新生成代理类,会多出一个WSE版本的

如:

<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42"), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="PrintService", [Namespace]:="http://tempuri.org/")> _
Partial Public Class PrintServiceWse

<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42"), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="PrintService", [Namespace]:="http://tempuri.org/")> _
Partial Public Class PrintService


使用WSE的就好使了,

另外,我还在客户端的配置文件中加入了这个


<microsoft.web.services3>
<messaging>
<maxMessageLength value="-1" />
<mtom clientMode="On" />
</messaging>
</microsoft.web.services3>
dragonlyf 2007-10-31
  • 打赏
  • 举报
回复
可能webservice部署有问题,部署的IIS重启下看看 HTTP/ASMX错误是服务端程序有问题

12,162

社区成员

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

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