I use attachments in a message example, by creating a soap envelope
and adding attachments to the call object. The attachments arrive at
the service side together with my soapenvelope. Is this way to add
attachments in a message oriented environment? If so, in the latest
beta release I can not find the class AttachmentPart.
This is the code on the client side I currently use:
Options opts = new Options(args);
opts.setDefaultURL(ser);
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new URL(opts.getURL())
);
SOAPEnvelope se= new SOAPEnvelope();
FileReader fr = new FileReader (filename);
DocumentBuilder xdb =
XMLParserUtils.getXMLDocBuilder();
Document doc = xdb.parse (new InputSource (fr));
SOAPBodyElement sbe = new SOAPBodyElement(doc.getDocumentElement());
se.addBodyElement(sbe);
// create attachement here
DataHandler dhSource = new DataHandler( new FileDataSource( filename
));
AttachmentPart ap = new AttachmentPart(dhSource);
call.addAttachmentPart(ap);
dhSource = new DataHandler( new FileDataSource( filename ));
ap = new AttachmentPart(dhSource);
call.addAttachmentPart(ap);
Message m1=call.getMessageContext().getCurrentMessage();
SOAPEnvelope se1 = call.invoke( se);
Frank van Lingen