.net调用java的webservice时服务器MTOM模式报错

未处理 System.Exception
  Message="出错啦!"
  Source="ConsoleApplication7"
  StackTrace:
       在 ConsoleApplication7.Program.Main(String[] args) 位置 C:\Users\chen\Documents\Visual Studio 2008\Projects\ConsoleApplication7\ConsoleApplication7\Program.cs:行号 120
       在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       在 System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.ServiceModel.ProtocolException
       Message="响应消息的内容类型 multipart/related; type=\"application/xop+xml\"; start=\"<soap.xml@xfire.codehaus.org>\"; start-info=\"text/xml\"; boundary=\"----=_Part_32_33259522.1385518574113\" 与绑定(text/xml; charset=utf-8)的内容类型不匹配。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。响应的前 1022 个字节为:“\r\n------=_Part_32_33259522.1385518574113\r\nContent-Type: application/xop+xml; charset=UTF-8; type=\"text/xml\"\r\nContent-Transfer-Encoding: 8bit\r\nContent-ID: <soap.xml@xfire.codehaus.org>\r\n\r\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soap:Header>\n<wsse:Security soap:mustUnderstand=\"1\" xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"><ds:Signature Id=\"Signature-5184696\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n<ds:SignedInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n<ds:CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n<ds:SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\" />\n<ds:Reference URI=\"#Timestamp-5896909\" xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">\n<ds:Transforms xmlns:ds=\"http://w”。"
       Source="mscorlib"
       StackTrace:
         Server stack trace:
            在 System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
            在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
            在 System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
            在 System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
            在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
            在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
            在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
            在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
         Exception rethrown at [0]:
            在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
            在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
            在 ConsoleApplication7.ServiceReference2.SolEdiFileUploadWebServicePortType.doEdiFileUpload(Attafile[] in0)
            在 ConsoleApplication7.ServiceReference2.SolEdiFileUploadWebServicePortTypeClient.doEdiFileUpload(Attafile[] in0) 位置 C:\Users\chen\Documents\Visual Studio 2008\Projects\ConsoleApplication7\ConsoleApplication7\Service References\ServiceReference2\Reference.cs:行号 491
            在 ConsoleApplication7.Program.Main(String[] args) 位置 C:\Users\chen\Documents\Visual Studio 2008\Projects\ConsoleApplication7\ConsoleApplication7\Program.cs:行号 102
       InnerException:

 

 

解决方案:

app.config配置文件中  一开始使用的是textMessageEncoding  改为 mtomMessageEncoding

 

 <customBinding>
                <binding name="Custom11">
                    <textMessageEncoding messageVersion="Soap11" />
                    <security defaultAlgorithmSuite="Basic128" allowSerializedSigningTokenOnReply="true"
                        authenticationMode="MutualCertificate" requireDerivedKeys="false"
                        securityHeaderLayout="Lax" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
                        <secureConversationBootstrap />
                    </security>
                    <httpsTransport maxReceivedMessageSize="65536000" authenticationScheme="Ntlm"
                        proxyAuthenticationScheme="Basic" />
                </binding>
            </customBinding>

 

问题解决~!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值