WebSphere brand IBM WebSphere Telecom Web Services Server, Version 7.1

SOAP attachment code snippet

The following shows a snippet of code for retrieving an attachment from an inbound SOAP message with attachments.

SOAP attachment code snippet:
public void mediate(InputTerminal input, DataObject message)
    throws MediationConfigurationException, MediationBusinessException {

        ServiceMessageObject smo = (ServiceMessageObject)message;

        Attachments attachments = Attachments.INSTANCE;
        String contextID = attachments.getAttachmentContextIDForSMO(smo);
        Iterator it = attachments.getAllMetaData(contextID);
        // In this example, we assume there’s one attachment and take the first one
        AttachmentMetaData metadata = (AttachmentMetaData)it.next();
        InputStream is = attachments.getAttachmentContent(contextID,
                metadata.getAttachmentID());
        // Read from stream


}



Terms of use
(C) Copyright IBM Corporation 2009. All Rights Reserved.