none
WCF send MTOM to Java Web Service with Content-Disposition RRS feed

  • Question

  • Hi,

    When WCF send the MTOM request to the Java Web Service, it does not generate the Content-Disposition before the starting of the MTOM binary. I am able to add it in the Header through code but it must be after the MTOM binary.

    Why WCF does not generate Content-Disposition?

    POST http://test/Port HTTP/1.1
    MIME-Version: 1.0
    Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:e6bc7744-a573-44b4-95c3-d7cf4d7aeb6d+id=1";start-info="application/soap+xml"; action=""
    Host: test.dev.com:8082
    Content-Length: 878047
    Expect: 100-continue
    Connection: Keep-Alive


    --uuid:e6bc7744-a573-44b4-95c3-d7cf4d7aeb6d+id=1
    Content-ID: <http://tempuri.org/0>
    Content-Transfer-Encoding: 8bit
    Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml"

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo+t9tTqyZKpKoDMIlmRpC3kAAAAAyucgdOHg0kKmGhn8Sdn/IfbI6cqxSVNDiMlHmYRkqecACQAA</VsDebuggerCausalityData></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><createRecord xmlns="http://ws.test.com/"><username xmlns="">test</username><service_username xmlns="">test</service_username><service_password xmlns="">hello</service_password><dataHandler xmlns=""><xop:Include href="cid:http%3A%2F%2Ftempuri.org%2F1%2F636257390207793164" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></dataHandler><file_ref_num xmlns="">0049498</file_ref_num><record_name xmlns="">Chrysanthemum.jpg</record_name><record_type xmlns="">PAPERS, &amp; REPORTS</record_type><record_date xmlns="">12/08/2013</record_date><security_class xmlns="">10</security_class><authors xmlns="">testuser13</authors><authors_org xmlns="">test</authors_org><subject xmlns="">.jpg</subject><title xmlns="">Chrysanthemum</title><keywords xmlns="">0001488|320317</keywords></createRecord></s:Body></s:Envelope>
    --uuid:e6bc7744-a573-44b4-95c3-d7cf4d7aeb6d+id=1
    Content-ID: <http://tempuri.org/1/636257390207793164>
    Content-Transfer-Encoding: binary
    Content-Type: application/octet-stream
    --> Missing -- Content-Dis; name="636257390207793164"; filename="636257390207793164" 

    --MTOM binary

    Wednesday, March 22, 2017 10:07 AM

All replies

  • Did you get any error? How did WCF send MTOM to Java Web Service? Did you create a WCF Service, and add the Java Web Service reference in WCF Service? It seems you request Java Web Service from a client, if so, will Content-Disposition be added if you send request from winform application?

    Based on Content-Disposition, it seems to be added to response instead of request. Is there a correct request to Java Web Service? If there is, I suggest you compare the difference between WCF request and this request.

    >> Missing -- Content-Dis; name="636257390207793164"; filename="636257390207793164"

    If you add Content-Dis to request, and send it by Fiddler, will it work?


    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.

    Thursday, March 23, 2017 2:57 AM
  • I am using the .NET console application to consume Documentum Web Service(Java based).
    The error i get is "Enable MTOM and attach file"
    I am using Fiddler to add the Content-Disposition manually and resend it. This is working.

    We compare the SOAP UI generated message with the .NET WCF generated message. From there we find out the difference. It's the Content-Disposition that is missing.

    Thursday, March 23, 2017 6:35 AM
  • >>I am using the .NET console application to consume Documentum Web Service(Java based)

    According this, there are .net console application and Java Web Service. Is Java Web Service soap service or rest service? What is WCF? How did WCF generate message between console application and Java Web Service? Did you use Add Service Reference in console application to generate WCF client which will call Java Web Service? If so, could you share us the code calling Java Web Service from console application?

    >>I am able to add it in the Header through code but it must be after the MTOM binary.

    How did you add Header? I suggest you refer below link to add header.

    #Adding Custom MessageHeader and HTTP header to a WCF method call in a Windows Store app or Windows Phone app

    https://blogs.msdn.microsoft.com/wsdevsol/2014/02/07/adding-custom-messageheader-and-http-header-to-a-wcf-method-call-in-a-windows-store-app-or-windows-phone-app/


    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.

    Friday, March 24, 2017 5:13 AM
  • Is Java Web Service soap service or rest service? SOAP service

    Did you use Add Service Reference in console application to generate WCF client which will call Java Web Service? Yes

    How did you add Header? I suggest you refer below link to add header.
    I have followed the link that you send. but it will add it in the header area not in the place that we want.

    Is the content-disposition a standard thing?

    Actually Java Web service expose as DataHandler object which will become byte array when exposed to .NET

    https://docs.oracle.com/javase/7/docs/api/javax/activation/DataHandler.html

    The DataHandler object will call getName to get the file name which is empty.

    Monday, March 27, 2017 5:19 AM
  • Do you mean both ways in the provided link to add header did not work for you? Where did you want to add the header?

    I suggest you try WCF Extensibility – Message Inspectors which could control the sent messages.


    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.

    Tuesday, March 28, 2017 3:07 AM
  • Hi

    Did you find the solution for this issue?

    Friday, October 23, 2020 2:37 PM