Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

soap mulitple image attachements.

 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to attach several images to a soap message.
I can get one image to attach but additonal attachements will not work. What am I doing wrong.

String imageFile1String = fileName1.getText();
System.out.println("fileName1 = " + imageFile1String);
URL imageFile1URL = null;
try {
imageFile1URL = new URL(imageFile1String);
} catch (MalformedURLException e2) {
e2.printStackTrace();
}
DataHandler handler1 = new DataHandler(imageFile1URL);
AttachmentPart attachPart1 = message.createAttachmentPart(handler1);
message.addAttachmentPart(attachPart1);
handler1=null;
imageFile1String=null;
imageFile1URL=null;








String imageFile2String = fileName2.getText();
System.out.println("fileName2 = " + imageFile2String);
URL imageFile2URL = null;
try {
imageFile2URL = new URL(imageFile2String);
} catch (MalformedURLException e2) {
e2.printStackTrace();
}
DataHandler handler2 = new DataHandler(imageFile2URL);
AttachmentPart attachPart2 = message.createAttachmentPart(handler2);
message.addAttachmentPart(attachPart2);
handler2=null;
imageFile2String=null;
imageFile2URL=null;
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by peter cooke:
I am trying to attach several images to a soap message.
I can get one image to attach but additonal attachements will not work.


what is the error message you are getting ? BTW Is your method is configured to attach more than one image ?
 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yesterday the application:
when there was one image attachment it wrote the image binary.
when there was more than 1 image attachment, the process wrote one image, then hung in createAttachment()

Today:Grumble (have to give the procedure) it is hanging in another location. for some reason now it hangs when I write the soap message to the file system)

 
peter cooke
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to work through things.... learned my problem was my understanding of api.

Thanks
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for update. :roll:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic