You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by BTInternet <mg...@btinternet.com> on 2003/07/28 10:58:00 UTC
Attachment problems
I am trying to create a soap message with attachments and running into a
problem I cannot figure out. Below is a fragment of code used to add an
attachment to a SOAP message. It throws a nullPointer Exception in the
createAttachmentPart method. Any ideas?
URL report = new File(filePath).toURL();
DataHandler dataHandler = new DataHandler(report);
System.out.println(dataHandler.getContentType());
// Exception thrown at this point
AttachmentPart attachment =
message.createAttachmentPart(dataHandler);
System.out.println(attachment.getContentType());
attachment.setContentId("report_id");
message.addAttachmentPart(attachment);
Thanks
Martin