/** * Internalizes the contents of the given <CODE> * InputStream</CODE> object into a new <CODE>SOAPMessage</CODE> * object and returns the <CODE>SOAPMessage</CODE> object. * @param mimeheaders the transport-specific headers * passed to the message in a transport-independent fashion * for creation of the message * @param inputstream the <CODE>InputStream</CODE> object * that contains the data for a message * @return a new <CODE>SOAPMessage</CODE> object containing the * data from the given <CODE>InputStream</CODE> object * @throws IOException if there is a * problem in reading data from the input stream * @throws SOAPException if the message is invalid */ public SOAPMessage createMessage( MimeHeaders mimeheaders, InputStream inputstream) throws IOException, SOAPException { Message message = new Message(inputstream, false, mimeheaders); message.setMessageType(Message.REQUEST); return message; } }
/** * Internalizes the contents of the given <CODE> * InputStream</CODE> object into a new <CODE>SOAPMessage</CODE> * object and returns the <CODE>SOAPMessage</CODE> object. * @param mimeheaders the transport-specific headers * passed to the message in a transport-independent fashion * for creation of the message * @param inputstream the <CODE>InputStream</CODE> object * that contains the data for a message * @return a new <CODE>SOAPMessage</CODE> object containing the * data from the given <CODE>InputStream</CODE> object * @throws IOException if there is a * problem in reading data from the input stream * @throws SOAPException if the message is invalid */ public SOAPMessage createMessage( MimeHeaders mimeheaders, InputStream inputstream) throws IOException, SOAPException { Message message = new Message(inputstream, false, mimeheaders); message.setMessageType(Message.REQUEST); return message; } }
/** * Internalizes the contents of the given <CODE> * InputStream</CODE> object into a new <CODE>SOAPMessage</CODE> * object and returns the <CODE>SOAPMessage</CODE> object. * @param mimeheaders the transport-specific headers * passed to the message in a transport-independent fashion * for creation of the message * @param inputstream the <CODE>InputStream</CODE> object * that contains the data for a message * @return a new <CODE>SOAPMessage</CODE> object containing the * data from the given <CODE>InputStream</CODE> object * @throws IOException if there is a * problem in reading data from the input stream * @throws SOAPException if the message is invalid */ public SOAPMessage createMessage( MimeHeaders mimeheaders, InputStream inputstream) throws IOException, SOAPException { Message message = new Message(inputstream, false, mimeheaders); message.setMessageType(Message.REQUEST); return message; } }
public void invoke(MessageContext msgContext) throws AxisFault { log.debug("Enter: EchoHandler::invoke"); try { Message msg = msgContext.getRequestMessage(); SOAPEnvelope env = (SOAPEnvelope) msg.getSOAPEnvelope(); msgContext.setResponseMessage( new Message( env ) ); } catch( Exception e ) { log.error( Messages.getMessage("exception00"), e ); throw AxisFault.makeFault(e); } log.debug("Exit: EchoHandler::invoke"); }
public void invoke(MessageContext msgContext) throws AxisFault { log.debug("Enter: EchoHandler::invoke"); try { Message msg = msgContext.getRequestMessage(); SOAPEnvelope env = (SOAPEnvelope) msg.getSOAPEnvelope(); msgContext.setResponseMessage( new Message( env ) ); } catch( Exception e ) { log.error( Messages.getMessage("exception00"), e ); throw AxisFault.makeFault(e); } log.debug("Exit: EchoHandler::invoke"); }
public void invoke(MessageContext msgContext) throws AxisFault { log.debug("Enter: EchoHandler::invoke"); try { Message msg = msgContext.getRequestMessage(); SOAPEnvelope env = (SOAPEnvelope) msg.getSOAPEnvelope(); msgContext.setResponseMessage( new Message( env ) ); } catch( Exception e ) { log.error( Messages.getMessage("exception00"), e ); throw AxisFault.makeFault(e); } log.debug("Exit: EchoHandler::invoke"); }
private void doVisiting(MessageContext msgContext, HandlerIterationStrategy visitor) throws AxisFault { int i = 0 ; try { Enumeration enumeration = handlers.elements(); while (enumeration.hasMoreElements()) { Handler h = (Handler)enumeration.nextElement(); visitor.visit(h, msgContext); i++; } } catch( AxisFault f ) { // Something went wrong. If we haven't already put this fault // into the MessageContext's response message, do so and make sure // we only do it once. This allows onFault() methods to safely // set headers and such in the response message without them // getting stomped. if (!msgContext.isPropertyTrue(CAUGHTFAULT_PROPERTY)) { // Attach the fault to the response message; enabling access to the // fault details while inside the handler onFault methods. Message respMsg = new Message(f); msgContext.setResponseMessage(respMsg); msgContext.setProperty(CAUGHTFAULT_PROPERTY, Boolean.TRUE); } while( --i >= 0 ) ((Handler) handlers.elementAt( i )).onFault( msgContext ); throw f; } }
private void doVisiting(MessageContext msgContext, HandlerIterationStrategy visitor) throws AxisFault { int i = 0 ; try { Enumeration enumeration = handlers.elements(); while (enumeration.hasMoreElements()) { Handler h = (Handler)enumeration.nextElement(); visitor.visit(h, msgContext); i++; } } catch( AxisFault f ) { // Something went wrong. If we haven't already put this fault // into the MessageContext's response message, do so and make sure // we only do it once. This allows onFault() methods to safely // set headers and such in the response message without them // getting stomped. if (!msgContext.isPropertyTrue(CAUGHTFAULT_PROPERTY)) { // Attach the fault to the response message; enabling access to the // fault details while inside the handler onFault methods. Message respMsg = new Message(f); msgContext.setResponseMessage(respMsg); msgContext.setProperty(CAUGHTFAULT_PROPERTY, Boolean.TRUE); } while( --i >= 0 ) ((Handler) handlers.elementAt( i )).onFault( msgContext ); throw f; } }
/** * turn any Exception into an AxisFault, log it, set the response * status code according to what the specifications say and * return a response message for posting. This will be the response * message passed in if non-null; one generated from the fault otherwise. * * @param exception what went wrong * @param responseMsg what response we have (if any) * @return a response message to send to the user */ private Message convertExceptionToAxisFault(Exception exception, Message responseMsg) { logException(exception); if (responseMsg == null) { AxisFault fault = AxisFault.makeFault(exception); processAxisFault(fault); responseMsg = new Message(fault); } return responseMsg; }
/** * turn any Exception into an AxisFault, log it, set the response * status code according to what the specifications say and * return a response message for posting. This will be the response * message passed in if non-null; one generated from the fault otherwise. * * @param exception what went wrong * @param responseMsg what response we have (if any) * @return a response message to send to the user */ private Message convertExceptionToAxisFault(Exception exception, Message responseMsg) { logException(exception); if (responseMsg == null) { AxisFault fault = AxisFault.makeFault(exception); processAxisFault(fault); responseMsg = new Message(fault); } return responseMsg; }
/** * turn any Exception into an AxisFault, log it, set the response * status code according to what the specifications say and * return a response message for posting. This will be the response * message passed in if non-null; one generated from the fault otherwise. * * @param exception what went wrong * @param responseMsg what response we have (if any) * @return a response message to send to the user */ protected Message convertExceptionToAxisFault (Exception exception, Message responseMsg) { logException (exception); if (responseMsg == null) { AxisFault fault = AxisFault.makeFault (exception); processAxisFault (fault); responseMsg = new Message (fault); } return responseMsg; }
/** * turn any Exception into an AxisFault, log it, set the response * status code according to what the specifications say and * return a response message for posting. This will be the response * message passed in if non-null; one generated from the fault otherwise. * * @param exception what went wrong * @param responseMsg what response we have (if any) * @return a response message to send to the user */ protected Message convertExceptionToAxisFault (Exception exception, Message responseMsg) { logException (exception); if (responseMsg == null) { AxisFault fault = AxisFault.makeFault (exception); processAxisFault (fault); responseMsg = new Message (fault); } return responseMsg; }
/** * turn any Exception into an AxisFault, log it, set the response * status code according to what the specifications say and * return a response message for posting. This will be the response * message passed in if non-null; one generated from the fault otherwise. * * @param exception what went wrong * @param responseMsg what response we have (if any) * @return a response message to send to the user */ protected Message convertExceptionToAxisFault (Exception exception, Message responseMsg) { logException (exception); if (responseMsg == null) { AxisFault fault = AxisFault.makeFault (exception); processAxisFault (fault); responseMsg = new Message (fault); } return responseMsg; }
/** * turn any Exception into an AxisFault, log it, set the response * status code according to what the specifications say and * return a response message for posting. This will be the response * message passed in if non-null; one generated from the fault otherwise. * * @param exception what went wrong * @param responseMsg what response we have (if any) * @return a response message to send to the user */ private Message convertExceptionToAxisFault(Exception exception, Message responseMsg) { logException(exception); if (responseMsg == null) { AxisFault fault = AxisFault.makeFault(exception); processAxisFault(fault); responseMsg = new Message(fault); } return responseMsg; }
/** * Creates a new <CODE>SOAPMessage</CODE> object with the * default <CODE>SOAPPart</CODE>, <CODE>SOAPEnvelope</CODE>, * <CODE>SOAPBody</CODE>, and <CODE>SOAPHeader</CODE> objects. * Profile-specific message factories can choose to * prepopulate the <CODE>SOAPMessage</CODE> object with * profile-specific headers. * * <P>Content can be added to this message's <CODE> * SOAPPart</CODE> object, and the message can be sent "as is" * when a message containing only a SOAP part is sufficient. * Otherwise, the <CODE>SOAPMessage</CODE> object needs to * create one or more <CODE>AttachmentPart</CODE> objects and * add them to itself. Any content that is not in XML format * must be in an <CODE>AttachmentPart</CODE> object.</P> * @return a new <CODE>SOAPMessage</CODE> object * @throws SOAPException if a SOAP error occurs */ public SOAPMessage createMessage() throws SOAPException { SOAPEnvelope env = new SOAPEnvelope(); env.setSAAJEncodingCompliance(true); Message message = new Message(env); message.setMessageType(Message.REQUEST); return message; }
/** * Creates a new <CODE>SOAPMessage</CODE> object with the * default <CODE>SOAPPart</CODE>, <CODE>SOAPEnvelope</CODE>, * <CODE>SOAPBody</CODE>, and <CODE>SOAPHeader</CODE> objects. * Profile-specific message factories can choose to * prepopulate the <CODE>SOAPMessage</CODE> object with * profile-specific headers. * * <P>Content can be added to this message's <CODE> * SOAPPart</CODE> object, and the message can be sent "as is" * when a message containing only a SOAP part is sufficient. * Otherwise, the <CODE>SOAPMessage</CODE> object needs to * create one or more <CODE>AttachmentPart</CODE> objects and * add them to itself. Any content that is not in XML format * must be in an <CODE>AttachmentPart</CODE> object.</P> * @return a new <CODE>SOAPMessage</CODE> object * @throws SOAPException if a SOAP error occurs */ public SOAPMessage createMessage() throws SOAPException { SOAPEnvelope env = new SOAPEnvelope(); env.setSAAJEncodingCompliance(true); Message message = new Message(env); message.setMessageType(Message.REQUEST); return message; }
/** * Creates a new <CODE>SOAPMessage</CODE> object with the * default <CODE>SOAPPart</CODE>, <CODE>SOAPEnvelope</CODE>, * <CODE>SOAPBody</CODE>, and <CODE>SOAPHeader</CODE> objects. * Profile-specific message factories can choose to * prepopulate the <CODE>SOAPMessage</CODE> object with * profile-specific headers. * * <P>Content can be added to this message's <CODE> * SOAPPart</CODE> object, and the message can be sent "as is" * when a message containing only a SOAP part is sufficient. * Otherwise, the <CODE>SOAPMessage</CODE> object needs to * create one or more <CODE>AttachmentPart</CODE> objects and * add them to itself. Any content that is not in XML format * must be in an <CODE>AttachmentPart</CODE> object.</P> * @return a new <CODE>SOAPMessage</CODE> object * @throws SOAPException if a SOAP error occurs */ public SOAPMessage createMessage() throws SOAPException { SOAPEnvelope env = new SOAPEnvelope(); env.setSAAJEncodingCompliance(true); Message message = new Message(env); message.setMessageType(Message.REQUEST); return message; }
private Message handleFault(final AxisFault fault, final HttpResponse res, final MessageContext context) { Message responseMessage; final Element runtimeException = fault.lookupFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); logger.warning(Messages.getMessage("axisFault00"), fault); if (runtimeException != null) { //strip runtime details fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); } final int status = fault.getFaultCode().getLocalPart().startsWith("Server.Unauth") ? HttpServletResponse.SC_UNAUTHORIZED : HttpServletResponse.SC_INTERNAL_SERVER_ERROR; if (status == HttpServletResponse.SC_UNAUTHORIZED) { // unauth access results in authentication request // TODO: less generic realm choice? res.setHeader("WWW-Authenticate", "Basic realm=\"AXIS\""); } res.setStatus(status); responseMessage = context.getResponseMessage(); if (responseMessage == null) { responseMessage = new Message(fault); final SOAPPart soapPart = (SOAPPart) responseMessage.getSOAPPart(); soapPart.getMessage().setMessageContext(context); } return responseMessage; }
public void createExceptionResult(final Throwable exception) { messageContext.setPastPivot(true); AxisFault axisFault = null; if (exception instanceof Exception) { axisFault = AxisFault.makeFault((Exception) exception); axisFault.setFaultCodeAsString(Constants.FAULT_SERVER_GENERAL); } else { axisFault = new AxisFault("Server", "Server Error", null, null); } final SOAPFault fault = new SOAPFault(axisFault); final SOAPEnvelope envelope = new SOAPEnvelope(); envelope.addBodyElement(fault); final Message message = new Message(envelope); message.setMessageType(Message.RESPONSE); messageContext.setResponseMessage(message); }
private Message handleException(final MessageContext context, final HttpResponse res, final Exception e) { Message responseMessage; //other exceptions are internal trouble responseMessage = context.getResponseMessage(); res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); Message responseMsg = responseMessage; logger.warning(Messages.getMessage("exception00"), e); if (responseMsg == null) { final AxisFault fault = AxisFault.makeFault(e); //log the fault final Element runtimeException = fault.lookupFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); if (runtimeException != null) { logger.debug(Messages.getMessage("axisFault00"), fault); //strip runtime details fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION); } responseMsg = new Message(fault); } responseMessage = responseMsg; final SOAPPart soapPart = (SOAPPart) responseMessage.getSOAPPart(); soapPart.getMessage().setMessageContext(context); return responseMessage; }