none
.Net Core and MTOM RRS feed

  • Question

  • I apologize if this is in the wrong forum - there does not seem to be one for .net Core.

    I am trying to consume a Soap service with ASP .Net Core, but it seems that MTOM is not supported in .Net Core.

    The problem is that there are many Web Services out there that use MTOM, and we as developers have no control over that.  We can't just tell a third party that they have to update their web service.

    If .Net Core cannot consume these services, I don't see any point of going down the .net Core path.  From what I have read, Microsoft does not seem to interested in fixing this issue.

    We are trying to adopt .Net Core, but road blocks like these make it really difficult.

    My only option here is to go with a .Net Framework solution.

    Here is the excption:

    Message: 
        Test method UnitTest1.Should_Be_Able_To_Consume_WCF threw exception: 
        System.AggregateException: One or more errors occurred. (The content type multipart/related; type="application/xop+xml"; start="<http://tempuri.org/0>"; boundary="uuid:0b570f41-b787-490d-88fb-a15d746ce27f+id=2"; start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 704 bytes of the response were: '
        --uuid:0b570f41-b787-490d-88fb-a15d746ce27f+id=2
        Content-ID: <http://tempuri.org/0>
        Content-Transfer-Encoding: 8bit
        Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
        
        <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><PingResponse xmlns="http://tempuri.org/"><PingResult xmlns:a="http://schemas.datacontract.org/2004/07/FileNetGateway.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:Error i:nil="true" xmlns:b="http://schemas.datacontract.org/2004/07/System"/><a:HasError>false</a:HasError><a:Message>Alive at 9/9/2019 10:06:50 AM</a:Message></PingResult></PingResponse></s:Body></s:Envelope>
        --uuid:0b570f41-b787-490d-88fb-a15d746ce27f+id=2--
        '.) ---> System.ServiceModel.ProtocolException: The content type multipart/related; type="application/xop+xml"; start="<http://tempuri.org/0>"; boundary="uuid:0b570f41-b787-490d-88fb-a15d746ce27f+id=2"; start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 704 bytes of the response were: '
        --uuid:0b570f41-b787-490d-88fb-a15d746ce27f+id=2
        Content-ID: <http://tempuri.org/0>
        Content-Transfer-Encoding: 8bit
        Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
        
        <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><PingResponse xmlns="http://tempuri.org/"><PingResult xmlns:a="http://schemas.datacontract.org/2004/07/FileNetGateway.Models" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:Error i:nil="true" xmlns:b="http://schemas.datacontract.org/2004/07/System"/><a:HasError>false</a:HasError><a:Message>Alive at 9/9/2019 10:06:50 AM</a:Message></PingResult></PingResponse></s:Body></s:Envelope>
        --uuid:0b570f41-b787-490d-88fb-a15d746ce27f+id=2--
        '.
      Stack Trace: 
        at AsyncResult.End[TAsyncResult](IAsyncResult result)
        at SendAsyncResult.End(SendAsyncResult result)
        at ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
        at <>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)
        at --- End of inner exception stack trace ---
        at Task`1.GetResultCore(Boolean waitCompletionNotification)
        at UnitTest1.Should_Be_Able_To_Consume_WCF() in UnitTest1.cs line: 49
    Tuesday, September 10, 2019 2:51 PM

All replies

  • This question is better suited for the CoreFx Github repo than the C# forums as it is not specific to C#. As for your question the only support that has been available is WCF and that isn't directly supported in .NET Core. You can refer to the following about WCF support in .NET Core. Calling is easier than hosting of course.

    Having said that there was an extension available that would allow the generation of the client side code in .NET Core but I cannot say if it is still supported. Again the CoreFx Github repo is where you should ask.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, September 10, 2019 7:46 PM
    Moderator
  • Hi WRBehning,

    Thank you for posting here.

    As CoolDadTx said, I think WCF forum is more suitable for your question. Therefore, I will move it to get professional support.

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, September 11, 2019 1:45 AM
  • Hi,

    As far as I know, Mtom is used in Ws*-binding, which is a mechanism for transmitting large binary attachments with soap messages as raw bytes, allowing for smaller message.
    But DotnetCore is not well compatible with Ws*-binding.
    Thereby Mtom mechanism is not supported on the wcf client-side based on Core. I suggest you submit an issue for requiring new feature support on the official github repository.
    https://github.com/dotnet/wcf/issues
    Feel free to let me know if there is anything I can help with.
    Best Regards
    Abraham

    Wednesday, September 11, 2019 6:41 AM
    Moderator