SOAP request with mtom attachment: No attachment for id <id> found in [attachment]
Asked Answered
G

2

6

I try to connect to a SOAP web service using SoapUI (5.3.0). Additionally an mtom attachment should be send along. But it seems that there is some problem sending the attachment - I always get the following error message as a response:

No attachment for id someID found in [NameOfTheAttachmentFile.txt]

Here is what I did:

  1. Enabled the request property 'Enable MTOM'
  2. Added an attachment (in the Attchment section)
  3. Added some cid:12345
  4. Selected that cid within the "Part" column of the attachment

And here is part of the request:

<ws:stream mimeType="text/plain" uuid="0815" filename="Example.txt" ...>
     <ws:documentData>cid:1234</ws:documentData>
</ws:stream>

And as I can see in SoapUI's Raw view the document is send alongside the request... Any ideas whats causing the problem?

Generator answered 17/5, 2018 at 14:2 Comment(0)
G
11

I found the problem. Even though I "connected" the cid with the attachment SoapUI is not using that cid in the mtmom Content-ID section. So originally cid:1234 was used (and selected in the 'Part' column of the attachments). But when looking at the request SoapUI is using the file name:

Content-ID: <Example.txt>

Now when changing either

  • the ContentID manually to 1234 (in the attachement section) or
  • using the file name as cid:Example.txt then it is working.

It would have been helpful (similar to Part) if the Content-ID would be selectable or be prefilled with the existing cid in SoapUI.

Generator answered 17/5, 2018 at 14:16 Comment(0)
W
0

I shared this one since it might help anyone running into the same error by another cause:

The same behaviour also shows up when the server could not add or create the attachment. In my case the inputstream, which should contain information for the attachment, had an i/o issue and could not be consumed properly.

The problem was solved by not using the inputstream of the source directly (which was a respsonse of another service).

Debugging the soap-part on server side is definetly helpful on this one.

Weisbart answered 14/10, 2021 at 13:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.