Hi Dan/Chintan,
thanks for both your replys. Dan I'm currently using a filter because I'm setting up the user via to acegi security within the filter then passing
the request on to my service.
I have tried creating the soap response as below, but get the following error:-
org.apache.xmlbeans.impl.soap.SOAPException: Unable to create message factory for SOAP: null
every time the following line is called:-
MessageFactory messageFactory = MessageFactory.newInstance();
import org.apache.xmlbeans.impl.soap.MessageFactory;
import org.apache.xmlbeans.impl.soap.SOAPMessage;
import org.apache.xmlbeans.impl.soap.SOAPPart;
import org.apache.xmlbeans.impl.soap.SOAPException;
import javax.xml.transform.stream.StreamSource;
private void soapErrorResponse(String errorMessage, HttpServletRequest request, HttpServletResponse response )throws IOException
{
MyResponseMsg resp = new MyResponseMsg();
resp.setStatus(MyResponseMsg.ERROR);
ArrayList error = new ArrayList();
error.add("This is the error"+errorMessage);
resp.setFaults(error);
String xmlResults = new XStream().toXML(resp);
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
//Create objects for the message parts
SOAPPart soapPart = message.getSOAPPart();
StringBufferInputStream buffer = new StringBufferInputStream(xmlResults);
StreamSource preppedMsgSrc = new StreamSource(buffer);
soapPart.setContent(preppedMsgSrc);
//Save the message
message.saveChanges();
//Output soap error message back to the user
ServletOutputStream out =response.getOutputStream();
message.writeTo(out);
out.close();
}
Has anybody seen this before