public String getSoapAction() { return axis2MessageContext.getSoapAction(); }
public String getSoapAction() { return axis2MessageContext.getSoapAction(); }
private static String getContentTypeForBuilderSelection(String type, MessageContext msgContext) { /** * Handle special case where content-type : text/xml and SOAPAction = null consider as * POX (REST) message not SOAP 1.1. * * it's required use the Builder associate with "application/xml" here but should not * change content type of current message. * */ String cType = type; if (msgContext.getSoapAction() == null && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type) && msgContext.isDoingREST()) { cType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } return cType; }
private static String getContentTypeForBuilderSelection(String type, MessageContext msgContext) { /** * Handle special case where content-type : text/xml and SOAPAction = null consider as * POX (REST) message not SOAP 1.1. * * it's required use the Builder associate with "application/xml" here but should not * change content type of current message. * */ String cType = type; if (msgContext.getSoapAction() == null && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type) && msgContext.isDoingREST()) { cType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } return cType; }
public static String getContentType(String contentType, MessageContext msgContext) { String type; int index = contentType.indexOf(';'); if (index > 0) { type = contentType.substring(0, index); } else { type = contentType; } // Some services send REST responces as text/xml. We should convert it to // application/xml if its a REST response, if not it will try to use the SOAPMessageBuilder. // isDoingREST should already be properly set by HTTPTransportUtils.initializeMessageContext if (msgContext.isDoingREST() && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) { if (msgContext.isServerSide()) { if (msgContext.getSoapAction() == null) { // TODO - remove this logic. //type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } } else if (!msgContext.isPropertyTrue(Constants.Configuration.SOAP_RESPONSE_MEP)) { type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } } return type; }
public static String getContentType(String contentType, MessageContext msgContext) { String type; int index = contentType.indexOf(';'); if (index > 0) { type = contentType.substring(0, index); } else { type = contentType; } // Some services send REST responces as text/xml. We should convert it to // application/xml if its a REST response, if not it will try to use the SOAPMessageBuilder. // isDoingREST should already be properly set by HTTPTransportUtils.initializeMessageContext if (msgContext.isDoingREST() && HTTPConstants.MEDIA_TYPE_TEXT_XML.equals(type)) { if (msgContext.isServerSide()) { if (msgContext.getSoapAction() == null) { // TODO - remove this logic. //type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } } else if (!msgContext.isPropertyTrue(Constants.Configuration.SOAP_RESPONSE_MEP)) { type = HTTPConstants.MEDIA_TYPE_APPLICATION_XML; } } return type; }
public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { String action = messageContext.getSoapAction();
/** * Helper util method to get the logging done whenever injecting the message into synapse * * @param log - Log appender to be used to append logs * @param messageContext - MessageContext which will be logged */ public static void doHandlerLogging(Log log, MessageContext messageContext) { if (log.isDebugEnabled()) { log.debug("Synapse handler received a new message for message mediation..."); log.debug("Received To: " + (messageContext.getTo() != null ? messageContext.getTo().getAddress() : "null")); log.debug("SOAPAction: " + (messageContext.getSoapAction() != null ? messageContext.getSoapAction() : "null")); log.debug("WSA-Action: " + (messageContext.getWSAAction() != null ? messageContext.getWSAAction() : "null")); String[] cids = messageContext.getAttachmentMap().getAllContentIDs(); if (cids != null && cids.length > 0) { for (int i = 0; i < cids.length; i++) { log.debug("Attachment : " + cids[i]); } } log.debug("Body : \n" + messageContext.getEnvelope()); } }
public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { String action = messageContext.getSoapAction();
/** * Helper util method to get the logging done whenever injecting the message into synapse * * @param log - Log appender to be used to append logs * @param messageContext - MessageContext which will be logged */ public static void doHandlerLogging(Log log, MessageContext messageContext) { if (log.isDebugEnabled()) { log.debug("Synapse handler received a new message for message mediation..."); log.debug("Received To: " + (messageContext.getTo() != null ? messageContext.getTo().getAddress() : "null")); log.debug("SOAPAction: " + (messageContext.getSoapAction() != null ? messageContext.getSoapAction() : "null")); log.debug("WSA-Action: " + (messageContext.getWSAAction() != null ? messageContext.getWSAAction() : "null")); String[] cids = messageContext.getAttachmentMap().getAllContentIDs(); if (cids != null && cids.length > 0) { for (int i = 0; i < cids.length; i++) { log.debug("Attachment : " + cids[i]); } } log.debug("Body : \n" + messageContext.getEnvelope()); } }
/** * Whether the original request received by the synapse is REST * * @param originalInMsgCtx request message * @return <code>true</code> if the request was a REST request */ private static boolean isRequestRest(MessageContext originalInMsgCtx) { boolean isRestRequest = originalInMsgCtx.getProperty(NhttpConstants.REST_REQUEST_CONTENT_TYPE) != null; if (!isRestRequest) { String httpMethod = (String) originalInMsgCtx.getProperty( Constants.Configuration.HTTP_METHOD); isRestRequest = Constants.Configuration.HTTP_METHOD_GET.equals(httpMethod) || Constants.Configuration.HTTP_METHOD_DELETE.equals(httpMethod) || Constants.Configuration.HTTP_METHOD_PUT.equals(httpMethod) || RESTConstants.METHOD_OPTIONS.equals(httpMethod) || Constants.Configuration.HTTP_METHOD_HEAD.equals(httpMethod); if (!isRestRequest) { isRestRequest = Constants.Configuration.HTTP_METHOD_POST.equals(httpMethod) && HTTPTransportUtils.isRESTRequest( String.valueOf(originalInMsgCtx.getProperty( Constants.Configuration.MESSAGE_TYPE))); if(!isRestRequest) { isRestRequest = (String.valueOf(originalInMsgCtx.getProperty(Constants.Configuration.MESSAGE_TYPE)) .equals(HTTPConstants.MEDIA_TYPE_TEXT_XML) && originalInMsgCtx.getSoapAction() == null); } } } return isRestRequest; }
if (log.isDebugEnabled()) { log.debug("Request received to DSS: Data Service - " + msgContext.getServiceContext().getName() + ", Operation - " + msgContext.getSoapAction() + ", Request body - " + msgContext.getEnvelope().getText() + ", ThreadID - " + Thread.currentThread().getId()); if (log.isDebugEnabled()) { log.debug("Request processing completed from DSS: Data Service - " + msgContext.getServiceContext().getName() + ", Operation - " + msgContext.getSoapAction() + ", ThreadID - " + Thread.currentThread().getId());
private void sendUsingOutputStream(MessageContext msgContext) throws AxisFault { OMOutputFormat format = NhttpUtil.getOMOutputFormat(msgContext); MessageFormatter messageFormatter = MessageFormatterDecoratorFactory.createMessageFormatterDecorator(msgContext); OutputStream out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT); if (msgContext.isServerSide()) { OutTransportInfo transportInfo = (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO); if (transportInfo != null) { transportInfo.setContentType( messageFormatter.getContentType(msgContext, format, msgContext.getSoapAction())); } else { throw new AxisFault(Constants.OUT_TRANSPORT_INFO + " has not been set"); } } try { messageFormatter.writeTo(msgContext, format, out, false); out.close(); } catch (IOException e) { handleException("IO Error sending response message", e); } }
String contentType= formatter.getContentType(msgCtx, format, msgCtx.getSoapAction()); } else { return new SOAPMessageFormatter().getContentType( msgCtx, format, msgCtx.getSoapAction());
private void sendUsingOutputStream(MessageContext msgContext) throws AxisFault { OMOutputFormat format = NhttpUtil.getOMOutputFormat(msgContext); MessageFormatter messageFormatter = MessageFormatterDecoratorFactory.createMessageFormatterDecorator(msgContext); OutputStream out = (OutputStream) msgContext.getProperty(MessageContext.TRANSPORT_OUT); if (msgContext.isServerSide()) { OutTransportInfo transportInfo = (OutTransportInfo) msgContext.getProperty(Constants.OUT_TRANSPORT_INFO); if (transportInfo != null) { transportInfo.setContentType( messageFormatter.getContentType(msgContext, format, msgContext.getSoapAction())); } else { throw new AxisFault(Constants.OUT_TRANSPORT_INFO + " has not been set"); } } try { messageFormatter.writeTo(msgContext, format, out, false); out.close(); } catch (IOException e) { handleException("IO Error sending response message", e); } }
(mc.getTo() != null ? mc.getTo().getAddress() : "null")); traceOrDebug(traceOn, "SOAPAction: " + (mc.getSoapAction() != null ? mc.getSoapAction() : "null")); traceOrDebug(traceOn, "WSA-Action: " + (mc.getWSAAction() != null ? mc.getWSAAction() : "null"));
public void processMsg(ProcessingContext ctx, OMNamespace protocolNs) throws OMException, AxisFault { String trackId = "trackId_A_" + getNextTrackId(); if (WSMGParameter.showTrackId) { logger.debug(trackId + ": received."); } AdditionalMessageContent additionalMessageContent = new AdditionalMessageContent(ctx.getMessageContext() .getSoapAction(), ctx.getMessageContext().getMessageID()); additionalMessageContent.setTrackId(trackId); if (NameSpaceConstants.WSNT_NS.equals(protocolNs)) { onWSNTMsg(ctx, additionalMessageContent); setResponseMsg(ctx, trackId, protocolNs); } else { // WSE Notifications No specific namespace onWSEMsg(ctx, trackId, additionalMessageContent); setResponseMsg(ctx, trackId, protocolNs); } }
public void processMsg(ProcessingContext ctx, OMNamespace protocolNs) throws OMException, AxisFault { String trackId = "trackId_A_" + getNextTrackId(); if (WSMGParameter.showTrackId) { logger.debug(trackId + ": received."); } AdditionalMessageContent additionalMessageContent = new AdditionalMessageContent(ctx.getMessageContext() .getSoapAction(), ctx.getMessageContext().getMessageID()); additionalMessageContent.setTrackId(trackId); handleExtendedNotifications(ctx, protocolNs); if (NameSpaceConstants.WSNT_NS.equals(protocolNs)) { onWSNTMsg(ctx, additionalMessageContent); setResponseMsg(ctx, trackId, protocolNs); } else { // WSE Notifications No specific namespace onWSEMsg(ctx, trackId, additionalMessageContent); setResponseMsg(ctx, trackId, protocolNs); } }
/** * Create a rabbitMQ message with properties * * @param msgCtx message context from transport holding the message */ public RabbitMQMessage(MessageContext msgCtx) { this.soapAction = msgCtx.getSoapAction(); this.messageId = msgCtx.getMessageID(); this.correlationId = (String) msgCtx.getProperty(RabbitMQConstants.CORRELATION_ID); if ((correlationId == null) || (correlationId.isEmpty())) { this.correlationId = msgCtx.getMessageID(); msgCtx.setProperty(RabbitMQConstants.CORRELATION_ID, correlationId); } this.contentType = (String) msgCtx.getProperty("messageType"); this.setExpiration((String) msgCtx.getProperty(RabbitMQConstants.EXPIRATION)); this.setTimestamp((String) msgCtx.getProperty(RabbitMQConstants.TIME_STAMP)); this.setUser_id((String) msgCtx.getProperty(RabbitMQConstants.USER_ID)); this.setApp_id((String) msgCtx.getProperty(RabbitMQConstants.APP_ID)); this.setCluster_id((String) msgCtx.getProperty(RabbitMQConstants.CLUSTER_ID)); this.contentEncoding = (String) msgCtx.getProperty("CHARACTER_SET_ENCODING"); this.headers = (Map<String, Object>) msgCtx.getProperty(MessageContext.TRANSPORT_HEADERS); }
newMC.setMessageID(UIDGenerator.generateURNString()); newMC.setTo(ori.getTo()); newMC.setSoapAction(ori.getSoapAction());