Hi,
I have been trying for the last day to compose an rpc style service that also
sends an attachment. Initially I was trying to return a bean and also attach a
file to the SOAP message but whatever I try I cannot get this to work and there
is very limited documentation available.
Does anybody have example code that demonstrates how to do this? Below is the
code I have been trying to get to work, this line
"msg.addAttachmentPart(attachment);" cause a server side java.lang.verify error
due to the method signature (which has not changed) and I dont understand why.
Any help would be greatly appreciated. Below is my code, its just skeleton code
until I can get a file attached, I have removed the bean return type and made
the method return void for the time being:
public void getAllTestsFile(String organisationCode, String catalogueID, String
version) {
try {
MessageContext context = MessageContext.getCurrentContext();
Message msg = context.getResponseMessage();
msg.getAttachmentsImpl().setSendType(Attachments.SEND_TYPE_MIME);
DataHandler dh = new DataHandler(new FileDataSource("c:\\a.xml"));
AttachmentPart attachment = new AttachmentPart(dh);
attachment.setContentId("att1");
msg.addAttachmentPart(attachment);
msg.saveChanges();
} catch (Exception e) {
e.printStackTrace();
}
}
I should also point out that I have not amended the .wsdd in anyway that is
specific to this method.
Thanks,
Paul
********************************************************************************************************************
This message may contain confidential information. If you are not the intended
recipient please inform the
sender that you have received the message in error before deleting it.
Please do not disclose, copy or distribute information in this e-mail or take
any action in reliance on its contents:
to do so is strictly prohibited and may be unlawful.
Thank you for your co-operation.
NHSmail is the secure email and directory service available for all NHS staff
in England and Scotland
NHSmail is approved for exchanging patient data and other sensitive information
with NHSmail and GSI recipients
NHSmail provides an email address for your career in the NHS and can be
accessed anywhere
For more information and to find out how you can switch, visit
www.connectingforhealth.nhs.uk/nhsmail
********************************************************************************************************************