Adding an attachment to SOAP request

后端 未结 6 1978
旧巷少年郎
旧巷少年郎 2020-12-28 23:36

I am at a loose end as to how to add an attachment in my SOAP request. We have to consume a thrid party web service, built in java, which is the most convoluted thing I have

6条回答
  •  一整个雨季
    2020-12-28 23:58

    I think that you may have a couple of options:

    1) Use MTOM. This appears to automatically wrap the outgoing message in MIME blocks.

    2) Microsoft actually provides support for generating and reading XOP with mime through the XopDocument class, which is what SoapEnvelope inherits from.

    The save method is SaveToXopPackage and the read method is LoadFromXopPackage.

    However, I think that this approach may require you to perform the sending of the message yourself through an HttpWebRequest. This blog has an example of how to implement this. The downside is that this requires a lot of extra code and configuration in order to work correctly.

    The ideal solution would be to intercept the code that performs the envelope transmission, but I have been unable to locate the correct location for this in the pipeline.

提交回复
热议问题