binding.marshal(objContext,
soapContext,
new JAXBDataBindingCallback(objContext.getMethod(),
DataBindingCallback.Mode.PARTS,
null));
SOAPMessage msg = soapContext.getMessage();
PersistenceUtils pu = new PersistenceUtils();
InputStream is = pu.getContextAsInputStream(soapContext);
assert null != is;
MessageContext restored = pu.getContext(is);
assertEquals(3, restored.keySet().size());
assertEquals(soapContext.get(ObjectMessageContext.MESSAGE_INPUT),
restored.get(ObjectMessageContext.MESSAGE_INPUT));
Object[] params = (Object[])soapContext.get(ObjectMessageContext.METHOD_PARAMETERS);
Object[] restoredParams = (Object[])restored.get(ObjectMessageContext.METHOD_PARAMETERS);
assertEquals(params.length, restoredParams.length);
assertEquals(params[0], restoredParams[0]);
SOAPMessage restoredMsg = ((SOAPMessageContext)binding.
createBindingMessageContext(objContext)).getMessage();
assertEquals(msg.getSOAPBody().getChildNodes().getLength(),
restoredMsg.getSOAPBody().getChildNodes().getLength());
assertNull(msg.getSOAPHeader());
assertNull(restoredMsg.getSOAPHeader());
InputStream is2 = pu.getContextAsInputStream(restored);
is.reset();
is2.reset();
assertEquals(is.available(), is2.available());