我有一个正在运行的带有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& request, IClientChannel channel, InstanceContext instanceContext) in ValidXmlMessageInspector.cs:line 63
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.AfterReceiveRequestCore(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
<Type>System.Xml.XmlException</Type>
</ExceptionDetail>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
有什么建议吗?
答案 0 :(得分:2)
确保请求中使用的内容ID(cid :)与“附件”列表中元素的ContentID相同。
SoapUI请求示例:
答案 1 :(得分:0)
它没有WCF问题:
SOAPUI自动为您的附件生成ContentID。 但你不需要这个。只需删除ContentID,一切正常
Greetz Skary