New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOAP server: Response with MTOM attachment does not work #328

Closed
sburkard opened this Issue Jan 22, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@sburkard

sburkard commented Jan 22, 2018

Use case

SOAP server simulation with Citrus. Client sends request, server responds with an MTOM repsonse with attachment.

Inline attachment works fine

If the attachement is sent as inline attachment, it works

<testcase name="MtomSimulationXml">
    <actions>
        <ws:receive endpoint="soapServerSimulation">
            <message>
                <resource file="testfiles/mtom-request.xml"/>
            </message>
        </ws:receive>
        <ws:send endpoint="soapServerSimulation" mtom-enabled="true">
            <message>
                <resource file="testfiles/mtom-response.xml"/>
            </message>
            <!-- this attachment is correctly delivered to the client -->
            <ws:attachment content-id="myAttachment" content-type="application/octet-stream" mtom-inline="true" encoding-type="base64Binary">
                <ws:resource file="classpath:testfiles/attachment.pdf"/>
            </ws:attachment>
        </ws:send>
    </actions>
</testcase>

Problem

Normal MTOM response (NOT inline) does not work. It is not even a multipart response.

<testcase name="MtomSimulationXml">
    <actions>
        <ws:receive endpoint="soapServerSimulation">
            <message>
                <resource file="testfiles/mtom-request.xml"/>
            </message>
        </ws:receive>
        <ws:send endpoint="soapServerSimulation" mtom-enabled="true">
            <message>
                <resource file="testfiles/mtom-response.xml"/>
            </message>
            <!-- this attachment is NOT delivered to the client -->
            <ws:attachment content-id="myAttachment" content-type="application/octet-stream">
                <ws:resource file="classpath:testfiles/attachment.pdf"/>
            </ws:attachment>
        </ws:send>
    </actions>
</testcase>

Multipart response, but still no attachment

If I add this header to the testcase above, the attachment is still NOT delivered to the client, but it is at least a multipart response.

<header>
    <element name="citrus_http_Content-Type" value="application/xop+xml; charset=utf-8"/>
</header>

Example

I have attached an example project (citrus-mtom.zip) that includes a SoapUI project that acts as a client.

XML testcase with inline attachment works

  • Open SoapUI project in SoapUI. There is only 1 test request
  • Start XML testcase in IDE as JUnit test
  • When the server simulation waits for a request, send the request from SoapUI
  • SoapUI gets the response with inline attachement

Java testcase with normal attachment does not work

  • Start Java testcase in IDE as JUnit test (or modify the XML testcase according to the examples above)
  • When the server simulation waits for a request, send the request from SoapUI
  • SoapUI gets the response without attachement
  • Look at the RAW response view of the SoapUI test to see multipart structure

citrus-mtom.zip

@christophd christophd added this to the v2.7.4 milestone Jan 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment