use of org.apache.axiom.om.ds.ParserInputStreamDataSource.Data in project webservices-axiom by apache.
the class ParserInputStreamDataSourceTests method updatePedsDataWithMockInputStream.
private void updatePedsDataWithMockInputStream(ParserInputStreamDataSource peds) throws Exception {
SOAPEnvelope env = getMockEnvelope();
SOAPBody body = env.getBody();
Iterator iter = body.getChildElements();
InputStream mockInputStream = null;
ByteArrayOutputStream os = new ByteArrayOutputStream();
while (iter.hasNext()) {
OMElement om = (OMElement) iter.next();
om.serialize(os);
byte[] bArray = os.toByteArray();
mockInputStream = new ByteArrayInputStream(bArray);
break;
}
((Data) peds.getObject()).setInputStream(mockInputStream);
}
Aggregations