none
Options to read message from JAVA service with attachments. RRS feed

  • Question

  • I am getting following message when trying to call a function on a service in JAVA. The service returns a SOAP message and the developer if service is saying he returns the message as attachments to headers.

    So, I was thinking I will use WCF Message Inspector to strip the attachments. However, I see the error message below before my code for AfterReceiveReply in the Message Inspector is hit. What are my options in processing this message? Welcome all thoughts and comments.

    Thank you.

    The content type multipart/related; type="text/xml"; start="<71918569BCC0E7EF80EDCA044CDEB92F>";     boundary="----=_Part_22_1956738209.1367003108204" 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 569 bytes of the response were:

    Friday, April 26, 2013 7:18 PM

All replies

  • Hi,

    From my experience, when the data is sent as attachment, the soap message should contain an xop:include which has an href attribute whose value is the content id of the attachment part. Do you check that part?

    If you want to read the message in the inspector code, one thing you need to note, WCF Message objects can only be “consumed” once, so if the inspector code needs to read the message, it’s the responsibility of the inspector to recreate the message.

    #WCF Extensibility – Message Inspectors

    http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, April 29, 2013 6:57 AM
    Moderator
  • Hi Haixia,

    Thank you for your reply. However, my question is why is the error message (I have attached the error text below) thrown before the method AfterReceiveReply in the message inspector is reached? At this time I am just trying to read the message to see if the attachments come through. If I see the attachments in the AfterReceiveReply, I will store those attachments in the code.

    Any ideas?

    Thank you.

    ------- ERROR MESSAGE BELOW -----------------

    The content type multipart/related; type="text/xml"; start="<71918569BCC0E7EF80EDCA044CDEB92F>";     boundary="----=_Part_22_1956738209.1367003108204" 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 569 bytes of the response were:

    Monday, April 29, 2013 10:30 AM
  • Hi,

    From the error message, please check if there is a binding or contract mismatch for your service and client.

    And do you try set MessageEncoding="MTOM" to use MTOM to encode soap message as suggested in a post below?

    #Error consuming webservice, content type “application/xop+xml” does not match expected type “text/xml”

    http://stackoverflow.com/questions/10496186/error-consuming-webservice-content-type-application-xopxml-does-not-match-ex

    If the issue still exists, you may try enable tracing for your service to help to diagnose the issue and
    use SvcTraceViewer.exe tool to analyze the diagnostic traces.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Haixia_XieModerator Friday, May 3, 2013 10:28 AM
    • Unmarked as answer by AK1 Friday, May 3, 2013 1:12 PM
    Tuesday, April 30, 2013 9:28 AM
    Moderator
  • Haixia,

    Even after using MTOM encoding on the client side, I didn't get the service to communicate with my client. Also, as I mentioned in my original post, the service is a JAVA service hosted by someone else that I am consuming. I have no way to enable tracing and the service works if I use SOAPUI to test the service. So, the issue is consuming that service not with the service itself.

    Not sure if you have any other ideas.

    Thank you.


    • Edited by AK1 Friday, May 3, 2013 1:16 PM
    Friday, May 3, 2013 1:16 PM