.NET Framework Developer Center > .NET Development Forums > Windows Communication Foundation > MTOM issue? : MIME part with Content-ID not found
Ask a questionAsk a question
 

QuestionMTOM issue? : MIME part with Content-ID not found

  • Wednesday, August 27, 2008 1:01 AMflat-out Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hello.

    I'm stacking on the problem that might be MTOM or Java-.Net Interoperability issue.
    I found this thread asking same error "MIME part with Content-ID '...' not found"
    http://forums.microsoft.com/msdn/ShowPost.aspx?siteid=1&postid=3768026


    In the case of me, server isn't Cassini, but same problem happened.

    Program called web service to download a file from server with MTOM.
    Error message was "MIME part with Content-ID 'Content-ID 'cid:3a5779b3-3aec-4a80-89d5-6f6ece79522d@http%3A%2F%2Fcxf.apache.org%2F' not found.

     

    Server : Apache CXF 2.1.2 - MTOM enabled
    Client : Visual C# 2008 Express Edition sp1 - simply added service reference.

     

    ■ fragment of WSDL

     

    <xs:complexType name="AttachedFile">

           <xs:complexContent>
             <xs:extension base="tns:AbstractEntity">
               <xsTongue Tiedequence>
                 <xs:element minOccurs="0" name="holder" type="tns:holder" />
                    <xs:element minOccurs="0" name="fileImage" ns1:expectedContentTypes="application/octet-stream"
                      type="xs:base64Binary" xmlns:ns1="http://www.w3.org/2005/05/xmlmime" />
               </xsTongue Tiedequence>
              <xs:attribute name="fileName" type="xsTongue Tiedtring" />
              <xs:attribute name="fileType" type="xsTongue Tiedtring" />
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>


    ■ server outbound message

     

    Encoding: UTF-8
    Headers: {}
    Messages: Outbound Message (saved to tmp file):
    Filename: D:\Apache Software Foundation\Tomcat 6.0\temp\cxf-tmp-185844\cos49094tmp

    Payload:
    ------=_Part_0_7991815.1219215204847
    Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
    Content-Transfer-Encoding: binary
    Content-ID: <root.message@cxf.apache.org>

    <soap:Envelope xmlnsTongue Tiedoap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
        <ns2Big SmileownloadControlAttachedFileResponse xmlns:ns2="http://service.inc.xxxxx.xx.xx/">
          <return success="true">
            <file fileName="Sunset.jpg" termId="0" deleteFlag="false" updateFlag="false" addFlag="false">
              <fileImage>
                <xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include"
                  href="cid:3a5779b3-3aec-4a80-89d5-6f6ece79522d@http%3A%2F%2Fcxf.apache.org%2F"/>
              </fileImage>
            </file>
          </return>
        </ns2Big SmileownloadControlAttachedFileResponse>
      </soap:Body>
    </soap:Envelope>

    ------=_Part_0_7991815.1219215204847
    Content-Type: image/jpeg
    Content-Transfer-Encoding: binary
    Content-ID: <3a5779b3-3aec-4a80-89d5-6f6ece79522d@http%3A%2F%2Fcxf.apache.org%2F>

    ...File Content...

    ------=_Part_0_7991815.1219215204847--
    --------------------------------------

     

    ■ client app.config

     

    <bindings>
      <basicHttpBinding>
        <binding name="IcServiceSoapBinding" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="655360"
          messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

     

    ■ client side error stack trace

     

    System.Xml.XmlMtomReader.ReadMimePart(String uri)
    System.Xml.XmlMtomReader.Read()
    System.Xml.XmlReader.ReadStartElement()
    System.Xml.XmlMtomReader.ReadElementContentAsBase64(Byte[] buffer, Int32 offset, Int32 count)
    System.Xml.Serialization.XmlSerializationReader.ReadByteArray(Boolean isBase64)
    System.Xml.Serialization.XmlSerializationReader.ToByteArrayBase64(Boolean isNull)
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIc.
      Read20_AttachedFile(Boolean isNullable, Boolean checkType)
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIc.
      Read42_AttachedFileResultMessage(Boolean isNullable, Boolean checkType)
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderIc.Read138_Item()
    Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer12.
      Deserialize(XmlSerializationReader reader)
    System.Xml.Serialization.XmlSerializer.Deserialize(
      XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

    Server stack trace:
    ---------------------------

    System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(
      XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer,
      MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts,
      Object[] parameters, Boolean isRequest)

     

     

    I removed annotations, @MTOM and  @XmlMimeType("application/octet-stream"),
    from server-side program, then programs worked fine, it is not using then MTOM though.

     

    I'm not .Net expert and I'm not sure which side, client-side or server-side, has problem.
    I need to add any configrations in app.config?
    Can anyone give me any suggestions about this problem?
     
    Thanks.

     

All Replies