/** * Get the array of response header elements */ public SOAPHeaderElement[] getResponseHeaders() { SOAPHeaderElement[] array = new SOAPHeaderElement[0]; try { if (_call == null) return array; Vector h = _call.getResponseMessage().getSOAPEnvelope().getHeaders(); array = new SOAPHeaderElement[h.size()]; h.copyInto(array); return array; } catch (Exception e) { return array; } }
/** * 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; } }
@Override public Call createCall() throws ServiceException { _call = new org.apache.axis.client.Call(this) { @Override public void setRequestMessage(Message msg) { super.setRequestMessage(msg); MimeHeaders mimeHeaders = msg.getMimeHeaders(); mimeHeaders.addHeader("SessionID", SessionID); } }; return _call; }
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"); }
/** * Creates a new empty <CODE>AttachmentPart</CODE> object. * Note that the method <CODE>addAttachmentPart</CODE> must be * called with this new <CODE>AttachmentPart</CODE> object as * the parameter in order for it to become an attachment to this * <CODE>SOAPMessage</CODE> object. * @return a new <CODE>AttachmentPart</CODE> object that can be * populated and added to this <CODE>SOAPMessage</CODE> * object */ public AttachmentPart createAttachmentPart() { if (!isAttachmentSupportEnabled(getMessageContext())) { throw new RuntimeException(Messages.getMessage("noAttachments")); } try { return (AttachmentPart) mAttachments.createAttachmentPart(); } catch (AxisFault af){ log.error(Messages.getMessage("exception00"), af); } return null; }
outMsg = new Message( new SocketInputStream(inp, socketHolder.getSocket()), false, contentType, contentLocation); MimeHeaders mimeHeaders = outMsg.getMimeHeaders(); for (Enumeration e = headers.keys(); e.hasMoreElements(); ) { String key = (String) e.nextElement(); mimeHeaders.addHeader(key, ((String) headers.get(key)).trim()); outMsg.setMessageType(Message.RESPONSE); msgContext.setResponseMessage(outMsg); if (log.isDebugEnabled()) { log.debug(outMsg.getSOAPEnvelope().toString());
HTTPConstants.HEADER_PROTOCOL_11) .append("\r\n"); MimeHeaders mimeHeaders = reqMessage.getMimeHeaders(); contentType = mimeHeaders.getHeader(HTTPConstants.HEADER_CONTENT_TYPE)[0]; } else { contentType = reqMessage.getContentType(msgContext.getSOAPConstants()); .append(reqMessage.getContentLength()) .append("\r\n"); } else { out = new TeeOutputStream(out, baos); reqMessage.writeTo(out); } catch (SOAPException e) { log.error(Messages.getMessage("exception00"), e); out = new TeeOutputStream(out, baos); reqMessage.writeTo(out); } catch (SOAPException e) { log.error(Messages.getMessage("exception00"), e);
final String contentLocation = req.getHeader(HTTPConstants.HEADER_CONTENT_LOCATION); final InputStream inputStream = req.getInputStream(); final Message requestMessage = new Message(inputStream, false, contentType, contentLocation); try { try { final String characterEncoding = (String) requestMessage.getProperty(SOAPMessage.CHARACTER_SET_ENCODING); if (characterEncoding != null) { messageContext.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, characterEncoding); final SOAPEnvelope env = requestMessage.getSOAPEnvelope(); if (env != null && env.getSOAPConstants() != null) { messageContext.setSOAPConstants(env.getSOAPConstants()); final String contentType1 = responseMessage.getContentType(soapConstants); res.setContentType(contentType1); final MimeHeaders responseMimeHeaders = responseMessage.getMimeHeaders(); for (final Iterator i = responseMimeHeaders.getAllHeaders(); i.hasNext(); ) { final MimeHeader responseMimeHeader = (MimeHeader) i.next(); contentType = responseMessage.getContentType(messageContext. getSOAPConstants()); responseMessage.writeTo(res.getOutputStream()); } catch (final Exception e) { logger.warning(Messages.getMessage("exception00"), e);
Message outMsg = new Message(releaseConnectionOnCloseStream, false, contentType, contentLocation); MimeHeaders responseMimeHeaders = outMsg.getMimeHeaders(); for (int i = 0; i < responseHeaders.length; i++) { Header responseHeader = responseHeaders[i]; responseHeader.getValue()); outMsg.setMessageType(Message.RESPONSE); msgContext.setResponseMessage(outMsg); if (log.isDebugEnabled()) { log.debug(outMsg.getSOAPPartAsString());
new Message(req.getInputStream(), false, req.getHeader(HTTPConstants.HEADER_CONTENT_TYPE), MimeHeaders requestMimeHeaders = requestMsg.getMimeHeaders(); for (Enumeration e = req.getHeaderNames(); e.hasMoreElements(); ) { String headerName = (String) e.nextElement(); requestEncoding = (String) requestMsg.getProperty(SOAPMessage. CHARACTER_SET_ENCODING); if (requestEncoding != null) { responseMsg = msgContext.getResponseMessage(); if (responseMsg == null) { responseMsg = new Message(fault); ((org.apache.axis.SOAPPart) responseMsg.getSOAPPart()). getMessage().setMessageContext(msgContext); res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); responseMsg = convertExceptionToAxisFault(e, responseMsg); ((org.apache.axis.SOAPPart) responseMsg.getSOAPPart()). getMessage().setMessageContext(msgContext); } catch (Throwable t) { logException(t); responseMsg = new Message(new AxisFault(t.toString(),t)); ((org.apache.axis.SOAPPart) responseMsg.getSOAPPart()). getMessage().setMessageContext(msgContext);
String contentType = requestMessage.getContentType(msgContext.getSOAPConstants()); ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE); logger.debug("Compressing request"); try (GZIPOutputStream gzipOs = new GZIPOutputStream(bos, BUFFER_SIZE)) { requestMessage.writeTo(gzipOs); requestMessage.writeTo(bos);
msgContext.getRequestMessage().writeTo(out); Attachments mAttachments = message.getAttachmentsImpl(); if (mAttachments != null && 0 != mAttachments.getAttachmentCount()) Message msg = new Message(response); msgContext.setResponseMessage(msg);
resMsg.setMessageType(Message.RESPONSE); SOAPEnvelope resEnv = resMsg.getSOAPEnvelope();
((org.apache.axis.Message)request).setMessageContext(call.getMessageContext()); Attachments attachments = ((org.apache.axis.Message) request).getAttachmentsImpl(); if (attachments != null) { Iterator iterator = attachments.getAttachments().iterator(); throw new SOAPException(mue); } catch (org.apache.axis.AxisFault af){ return new Message(af);
if (msg != null){ method.setRequestHeader(new Header(HTTPConstants.HEADER_CONTENT_TYPE, msg.getContentType(msgContext.getSOAPConstants()))); MimeHeaders mimeHeaders = msg.getMimeHeaders(); if (mimeHeaders != null) { for (Iterator i = mimeHeaders.getAllHeaders(); i.hasNext(); ) {
/** * Set the response message, and make sure that message is associated * with this MessageContext. * * @param respMsg the new response Message. */ public void setResponseMessage(Message respMsg) { responseMessage = respMsg; if (responseMessage != null) { responseMessage.setMessageContext(this); //if we have received attachments of a particular type // than that should be the default type to send. Message reqMsg = getRequestMessage(); if (null != reqMsg) { Attachments reqAttch = reqMsg.getAttachmentsImpl(); Attachments respAttch = respMsg.getAttachmentsImpl(); if (null != reqAttch && null != respAttch) { if (respAttch.getSendType() == Attachments.SEND_TYPE_NOTSET) //only if not explicity set. respAttch.setSendType(reqAttch.getSendType()); } } } }
public void writeRequest(OutputStream out) throws IOException { try { this.message.writeTo(out); } catch (SOAPException e) { throw new IOException(e.getMessage()); } }
/** * 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; }
/** * extract attachments from the current request * * @return a list of attachmentparts or an empty array for no attachments support in this axis * buid/runtime */ private AttachmentPart[] getMessageAttachments() throws AxisFault { Attachments messageAttachments = MessageContext.getCurrentContext().getRequestMessage().getAttachmentsImpl(); if (null == messageAttachments) { log.warn("No attachment support"); return new AttachmentPart[0]; } else { int attachmentCount = messageAttachments.getAttachmentCount(); AttachmentPart attachments[] = new AttachmentPart[attachmentCount]; Iterator it = messageAttachments.getAttachments().iterator(); int count = 0; while (it.hasNext()) { AttachmentPart part = (AttachmentPart) it.next(); attachments[count++] = part; } return attachments; } }
Attachments attachments = msg.getAttachmentsImpl(); boolean useAttachments = (attachments != null) && mUseAttachments; if (useAttachments) { useAttachments = !context.getMessageContext().getPastPivot() || context.getMessageContext().getRequestMessage().getAttachments().hasNext();