public static final String FAULTNODE = "node";
public void testFault() throws Exception
{
// Serialize
MessageContext msgContext = new MessageContext(new AxisServer());
msgContext.setSOAPConstants(SOAPConstants.SOAP12_CONSTANTS);
msgContext.setProperty(Constants.MC_NO_OPERATION_OK, Boolean.TRUE);
SOAPEnvelope msg = new SOAPEnvelope(SOAPConstants.SOAP12_CONSTANTS);
SOAPFault fault = new SOAPFault(new AxisFault(FAULTCODE, FAULTSUBCODE,
FAULTREASON, FAULTROLE,
FAULTNODE, null));
msg.addBodyElement(fault);
Writer stringWriter = new StringWriter();
SerializationContext context =
new SerializationContextImpl(stringWriter, msgContext);
context.setDoMultiRefs(false);
msg.output(context);
String msgString = stringWriter.toString();
// Deserialize and check
AxisServer server = new AxisServer();
Message message = new Message(msgString);
message.setMessageContext(new MessageContext(server));
SOAPEnvelope envelope = message.getSOAPEnvelope();
assertNotNull("envelope should not be null", envelope);