@Test
public void testSWA() throws Exception {
SOAPFactory soapFac = SOAPFactory.newInstance();
MessageFactory msgFac = MessageFactory.newInstance();
SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
SOAPMessage msg = msgFac.createMessage();
QName sayHi = new QName("http://apache.org/hello_world_rpclit", "sayHiWAttach");
msg.getSOAPBody().addChildElement(soapFac.createElement(sayHi));
AttachmentPart ap1 = msg.createAttachmentPart();
ap1.setContent("Attachment content", "text/plain");
msg.addAttachmentPart(ap1);
AttachmentPart ap2 = msg.createAttachmentPart();
ap2.setContent("Attachment content - Part 2", "text/plain");
msg.addAttachmentPart(ap2);
msg.saveChanges();
SOAPConnection con = conFac.createConnection();
URL endpoint = new URL("http://localhost:9008/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1");
SOAPMessage response = con.call(msg, endpoint);
QName sayHiResp = new QName("http://apache.org/hello_world_rpclit", "sayHiResponse");
assertNotNull(response.getSOAPBody().getChildElements(sayHiResp));
assertEquals(2, response.countAttachments());