I am using the message style. I have the following method: public Document processRequest(Document doc) { Document res_dom_doc = null; try { My_Message msg = new My_Message(doc); MyConnectionToExternalSystem conn = newMyConnectionToExternalSystem("<ip_address>",8686,"comm1"); My_Message res = conn.sendAndReceiveMessage(msg, 45000); res_dom_doc = res.getMsgAsDOMDocument(); } catch( Exception e ) { // } return res_dom_doc; }
If all goes well on my external system, this works perfectly. Sometimes the returned Document is a custom fault which I need to return to the client as a SOAP Fault. I added this code to help: SOAPBody sb = MessageContext.getCurrentContext().getResponseMessage().getSOAPPart().getEnvelope().getBody(); SOAPFault fault = sb.addFault(); fault.setFaultString(whatever the string is); fault.setFaultCode("Server"); But now I need to add the res_dom_doc, returned by my external system, as a child of the <detail> element of the soap fault. Can anyone please explain how I can do this? Using the code above, an empty detail element in returned and the res_dom_doc xml comes after the closing tag of soapfault ( </soapenv:Fault> ). thanks Joel