SOAPConnectionFactory soapFactory = SOAPConnectionFactory.newInstance();
SOAPConnection conn = soapFactory.createConnection();
MessageFactory msgfactory = MessageFactory.newInstance();
SOAPMessage msg = msgfactory.createMessage();
SOAPPart part = msg.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPBody body = envelope.getBody();
SOAPBodyElement operation = body.addBodyElement(envelope.createName("echoAttach"));
String content =
"This service is called SimpleEcho and is used for Echoing the datahandler";
DataHandler handler = new DataHandler(content,"text/plain");
==>> AttachmentPart attachment = msg.createAttachmentPart(handler);
attachment.setContentId("DESCRIPTION");
msg.addAttachmentPart(attachment);
SOAPMessage response = conn.call(msg,new URL("http://localhost:8081/axis/services/SimpleEcho"));
response.writeTo(System.out);
------------------------------------------------------------------------
