WCF:未找到SoapUI Content-Id的MTOM

时间:2014-11-03 13:09:53

标签: c# wcf soap mtom

我有一个正在运行的带有MTOM编码的WCF服务。 我自己的c#客户端可以毫无问题地使用此服务。

当我尝试通过SOAP UI发送请求时,我收到消息:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:InternalServiceFault</faultcode>
      <faultstring xml:lang="de-DE">MIME part with Content-ID 'cid:123456' not found.</faultstring>
      <detail>
        <ExceptionDetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
          <HelpLink i:nil="true"/>
          <InnerException i:nil="true"/>
          <Message>MIME part with Content-ID 'cid:123456' not found.</Message>
          <StackTrace>at System.Xml.XmlMtomReader.ReadMimePart(String uri)
   at System.Xml.XmlMtomReader.Read()
   at System.Xml.XmlDictionaryWriter.WriteNode(XmlDictionaryReader reader, Boolean defattr)
   at System.ServiceModel.Channels.ReceivedMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
   at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
   at System.ServiceModel.Channels.Message.OnCreateBufferedCopy(Int32 maxBufferSize, XmlDictionaryReaderQuotas quotas)
   at System.ServiceModel.Channels.Message.CreateBufferedCopy(Int32 maxBufferSize)
   at VAMS.Web.FE.Inspector.ValidXmlMessageInspector.AfterReceiveRequest(Message&amp; request, IClientChannel channel, InstanceContext instanceContext) in ValidXmlMessageInspector.cs:line 63
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.AfterReceiveRequestCore(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc&amp; rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
          <Type>System.Xml.XmlException</Type>
        </ExceptionDetail>
      </detail>
    </s:Fault>
  </s:Body>
</s:Envelope>

有什么建议吗?

2 个答案:

答案 0 :(得分:2)

确保请求中使用的内容ID(cid :)与“附件”列表中元素的ContentID相同。

SoapUI请求示例: SoapUI request sample

答案 1 :(得分:0)

它没有WCF问题:

SOAPUI自动为您的附件生成ContentID。 但你不需要这个。只需删除ContentID,一切正常

Greetz Skary