call.setTargetEndpointAddress( new URL(opts.getURL()) ); //Set the target service host and service location,
java.util.Stack rev= new java.util.Stack();
//Create an attachment referenced by a generated contentId.
AttachmentPart ap= new AttachmentPart(new javax.activation.DataHandler(
"Now is the time", "text/plain" ));
refs.add(ap.getContentIdRef()); //reference the attachment by contentId.
ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
call.addAttachmentPart(ap);
rev.push(ap);
//Create an attachment referenced by a set contentId.
String setContentId="rick_did_this";
ap= new AttachmentPart(new DataHandler(" for all good", "text/plain" ));
//new MemoryOnlyDataSource(
ap.setContentId(setContentId);
refs.add("cid:" + setContentId); //reference the attachment by contentId.
ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
call.addAttachmentPart(ap);
rev.push(ap);
//Create an attachment referenced by a absolute contentLocation.
ap= new AttachmentPart(new DataHandler( " men to", "text/plain" ));
//new MemoryOnlyDataSource( " men to", "text/plain" )));
ap.setContentLocation(baseLoc+ "/firstLoc");
refs.add(baseLoc+ "/firstLoc"); //reference the attachment by contentId.
ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
call.addAttachmentPart(ap);
rev.push(ap);
//Create an attachment referenced by relative location to a absolute location.
ap= new AttachmentPart(new DataHandler( " come to", "text/plain" ));
// new MemoryOnlyDataSource( " come to", "text/plain" )));
ap.setContentLocation(baseLoc+ "/secondLoc");
refs.add("secondLoc"); //reference the attachment by contentId.
ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
call.addAttachmentPart(ap);
rev.push(ap);
//Create an attachment referenced by relative location to a relative location.
ap= new AttachmentPart(new DataHandler( " the aid of their country.", "text/plain" ));
// new MemoryOnlyDataSource( " the aid of their country.", "text/plain" )));
ap.setContentLocation("thirdLoc");
refs.add("thirdLoc"); //reference the attachment by contentId.
ap.setMimeHeader(positionHTTPHeader, ""+refs.size() ); //create a MIME header indicating postion.
call.addAttachmentPart(ap);
rev.push(ap);
//Now build the message....