I have a soap request for which I am getting a response when hit directly from the SOAPUI. I am able to send the desired file via SOAPUI using cid and adding the file from attachments tab and selecting the part same as cid.
Tag used in SOAPUI to send attachment.
<set:FileContent>cid:1281067898880</set:FileContent>
I am trying to automate this call from java where I have constructed the same request and used AttachmentPart to attach a zip file.
Below is the error:
<env:Body><env:Fault><faultcode>env:Server< /faultcode><faultstring>Failure in SDOSerializer.deserialize.< /faultstring>< /env:Fault>< /env:Body>< /env:Envelope>
I assume the document is not being recognized. Please help me with attaching the ZIP file correctly to this soap request in java.
Below is the code:
File importedFile = new File("C:\\Users\\Documents\\sample\\documents.zip");
InputStream is = new ByteArrayInputStream(input.getBytes());
SOAPMessage request = MessageFactory.newInstance().createMessage(null, is);
FileDataSource src = new FileDataSource(importedFile);
DataHandler handler = new DataHandler(src);
AttachmentPart attachment = request.createAttachmentPart(handler);
attachment.setContentId("1281067898880");
request.addAttachmentPart(attachment);