List of utility methods to do SOAP Message
void | addAttachment(SOAPMessage soapMessage, String payloadId, String contentType, byte[] content) add Attachment addAttachment(soapMessage, payloadId, contentType, new ByteArrayInputStream(content));
|
void | addMessageHandler(Object binding, SOAPHandler Add a message handler to a SOAP binding final Binding b = ((BindingProvider) binding).getBinding(); List handlerList = b.getHandlerChain(); if (handlerList == null) handlerList = new ArrayList(); handlerList.add(handler); b.setHandlerChain(handlerList); |
void | addMimeHeader(SOAPMessage message, String name, String value) Adds a custom MIME header to a SOAPMessage . message.getMimeHeaders().setHeader(name, value); |
void | addNamespace(SOAPMessage message, String prefix, String uri) Adds a specified namespace to a SOAPMessage . message.getSOAPPart().getEnvelope().addNamespaceDeclaration(prefix, uri); |
SOAPMessage | constructMessage(String mimeHdrsFile, String msgFile) construct Message SOAPMessage message; MimeHeaders mimeHeaders = new MimeHeaders(); FileInputStream fis = new FileInputStream(msgFile); ObjectInputStream ois = new ObjectInputStream(new FileInputStream(mimeHdrsFile)); Hashtable hashTable = (Hashtable) ois.readObject(); ois.close(); if (hashTable.isEmpty()) { } else { ... |
String | convertSoapMessageToString(SOAPMessage message) convert Soap Message To String String result = null; if (message != null) { ByteArrayOutputStream baos = null; try { baos = new ByteArrayOutputStream(); message.writeTo(baos); result = baos.toString(); } catch (SOAPException e) { ... |
MimeHeaders | copy(MimeHeaders headers) copy MimeHeaders newHeaders = new MimeHeaders(); Iterator eachHeader = headers.getAllHeaders(); while (eachHeader.hasNext()) { MimeHeader currentHeader = (MimeHeader) eachHeader.next(); newHeaders.addHeader(currentHeader.getName(), currentHeader.getValue()); return newHeaders; |
MimeHeaders | copyMimeHeaders(MimeHeaders headers) Create a copy of an existing MimeHeaders object. MimeHeaders result = new MimeHeaders(); Iterator iterator = headers.getAllHeaders(); while (iterator.hasNext()) { MimeHeader hdr = (MimeHeader) iterator.next(); result.addHeader(hdr.getName(), hdr.getValue()); return result; |
SOAPMessage | create() Create an empty SOAPMessage MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
return soapMessage;
|
AttachmentPart | createAttachmentPart(String cid, DataHandler dh, SOAPMessage message) Create an SAAJ AttachmentPart from a JAXWS Attachment AttachmentPart ap = message.createAttachmentPart(dh);
ap.setContentId(cid);
return ap;
|