ByteArrayOutputStream out = new ByteArrayOutputStream();
orgEnvelope.serialize(out, format);
assertFalse(element.isExpanded());
// Parse the serialized message
Attachments att = new Attachments(new ByteArrayInputStream(out.toByteArray()), format.getContentType());
assertEquals(2, att.getAllContentIDs().length);
SOAPEnvelope envelope = OMXMLBuilderFactory.createSOAPModelBuilder(att).getSOAPEnvelope();
OMElement contentElement = envelope.getBody().getFirstElement().getFirstChildWithName(
new QName("http://ws.apache.org/axiom/test/jaxb", "content"));
OMText content = (OMText)contentElement.getFirstOMChild();
assertTrue(content.isBinary());