Forum Discussion

stamhaney's avatar
stamhaney
New Contributor
8 years ago

Add MTOM Attachment using SoapUI

Hi,
I am using soapui open source to add an attachment (MTOM enabled) to an operation and invoke the web service using java. When I execute the code, i get the message:

 

Receiving response: HTTP/1.1 415 Cannot process the message because the content type 'multipart/related; type="application/xop+xml";....

 

The same request when sent through the SoapUI UI interface, gives me a proper response.

 

The code I am using to add the attachment is:


WsdlRequest req = op.addNewRequest("Req1");
req.setRequestContent(op.createRequest(true));
File fileToAttach = new File("c:\\tmp\\Test1.txt");
req.attachFile(fileToAttach, true);
req.setMtomEnabled(true);

 

Do I have to call any other method for getting a proper response? Can you please let me know where am I going wrong?

Thank you

Shashank