/** * Compares key parts of the state from the current instance of * this class with the specified instance to see if they are * equivalent. * <p/> * This differs from the java.lang.Object.equals() method in * that the equals() method generally looks at both the * object identity (location in memory) and the object state * (data). * <p/> * * @param ctx The object to compare with * @return TRUE if this object is equivalent with the specified object * that is, key fields match * FALSE, otherwise */ public boolean isEquivalent(OperationContext ctx) { // NOTE: the input object is expected to exist (ie, be non-null) if (this.isComplete != ctx.isComplete()) { return false; } if (!this.axisOperation.equals(ctx.getAxisOperation())) { return false; } // TODO: consider checking the parent objects for equivalency // TODO: consider checking fields from the super class for equivalency return true; }
protected String getOperationName(MessageContext inMsg) throws AxisFault { AxisOperation op = inMsg.getOperationContext().getAxisOperation(); if (op == null) { throw new AxisFault( "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); } String operationName = null; if ((op.getName() == null) || ((operationName = JavaUtils.xmlNameToJava(op.getName().getLocalPart())) == null)) { throw new AxisFault("invalid operation found"); } return operationName; }
protected String getOperationName(MessageContext inMsg) throws AxisFault { AxisOperation op = inMsg.getOperationContext().getAxisOperation(); if (op == null) { throw new AxisFault( "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); } String operationName = null; if ((op.getName() == null) || ((operationName = JavaUtils.xmlNameToJava(op.getName().getLocalPart())) == null)) { throw new AxisFault("invalid operation found"); } return operationName; }
/** * Should the transport sender wait for a synchronous response to be received? * @param msgCtx the outgoing message context * @return true if a sync response is expected */ protected boolean waitForSynchronousResponse(MessageContext msgCtx) { return msgCtx.getOperationContext() != null && WSDL2Constants.MEP_URI_OUT_IN.equals( msgCtx.getOperationContext().getAxisOperation().getMessageExchangePattern()); }
protected String getOperationName(MessageContext inMsg) throws AxisFault { org.apache.axis2.description.AxisOperation op = inMsg.getOperationContext().getAxisOperation(); if (op == null) { throw new AxisFault( "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); } java.lang.String operationName = null; if ((op.getName() == null) || ((operationName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) == null)) { throw new AxisFault("invalid operation found"); } return operationName; }
protected String getOperationName(MessageContext inMsg) throws AxisFault { org.apache.axis2.description.AxisOperation op = inMsg.getOperationContext().getAxisOperation(); if (op == null) { throw new AxisFault( "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider"); } java.lang.String operationName = null; if ((op.getName() == null) || ((operationName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) == null)) { throw new AxisFault("invalid operation found"); } return operationName; }
private boolean isOutOnly(MessageContext messageIn, org.apache.axis2.context.MessageContext axis2Ctx) { return "true".equals(messageIn.getProperty(SynapseConstants.OUT_ONLY)) || axis2Ctx.getOperationContext() != null && WSDL2Constants.MEP_URI_IN_ONLY.equals( axis2Ctx.getOperationContext().getAxisOperation().getMessageExchangePattern()); }
/** * Should the transport sender wait for a synchronous response to be received? * @param msgCtx the outgoing message context * @return true if a sync response is expected */ protected boolean waitForSynchronousResponse(MessageContext msgCtx) { return msgCtx.getOperationContext() != null && WSDL2Constants.MEP_URI_OUT_IN.equals( msgCtx.getOperationContext().getAxisOperation().getMessageExchangePattern()); }
public void receive(MessageContext requestMessageContext) throws AxisFault { String operationName = requestMessageContext.getOperationContext().getAxisOperation().getName().getLocalPart(); AxisEngine.send(processorMap.get(operationName).process(requestMessageContext)); } }
private boolean isOutOnly(MessageContext messageIn, org.apache.axis2.context.MessageContext axis2Ctx) { return "true".equals(messageIn.getProperty(SynapseConstants.OUT_ONLY)) || axis2Ctx.getOperationContext() != null && WSDL2Constants.MEP_URI_IN_ONLY.equals(axis2Ctx.getOperationContext(). getAxisOperation().getMessageExchangePattern()); }
private boolean isAuthenticated(String remoteIP) { OperationContext opCtx = msgContext.getOperationContext(); ServiceContext serviceCtx = opCtx.getServiceContext(); String opName = opCtx.getAxisOperation().getName().getLocalPart(); String serviceName = serviceCtx.getAxisService().getName(); if ((serviceName.equals(ServerConstants.GLOBAL_ADMIN_SERVICE) || serviceName.equals(ClusteringConstants.NODE_MANAGER_SERVICE)) && (opName.equals("login") || opName.equals("logout"))) { return true; } String loginStatus = (String) serviceCtx.getServiceGroupContext(). getPropertyNonReplicable(ServerConstants.ADMIN_LOGGED_IN); boolean authenticated = "true".equals(loginStatus); if(!authenticated){ SimpleDateFormat date = new SimpleDateFormat("'['yyyy-MM-dd HH:mm:ss,SSSS']'"); log.warn("Illegal access attempt at " + date.format(new Date()) + " from IP address " + remoteIP); } return authenticated; }
public boolean mediate(MessageContext synCtx) { if (synCtx instanceof Axis2MessageContext) { Axis2MessageContext axis2smc = (Axis2MessageContext) synCtx; org.apache.axis2.context.MessageContext axis2MessageCtx = axis2smc.getAxis2MessageContext(); if (axis2MessageCtx != null) { String mep = axis2MessageCtx.getOperationContext().getAxisOperation(). getMessageExchangePattern(); if (WSDL2Constants.MEP_URI_IN_ONLY.equals(mep)) { synCtx.setProperty(SynapseConstants.OUT_ONLY, "true"); } // do nothing if two way } } return true; } }
public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getAxisOperation(); } } return null; }
public AxisOperation findOperation(AxisService service, MessageContext messageContext) throws AxisFault { RelatesTo relatesTo = messageContext.getRelatesTo(); if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Checking for OperationContext using RelatesTo : " + relatesTo); } if ((relatesTo != null) && (relatesTo.getValue() != null)) { ConfigurationContext configurationContext = messageContext.getConfigurationContext(); OperationContext operationContext = configurationContext.getOperationContext(relatesTo.getValue()); if (operationContext != null) { if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) { log.debug(messageContext.getLogIDString() + " Found OperationContext: " + operationContext); } return operationContext.getAxisOperation(); } } return null; }
public void acknowledgeMessage(MessageContext msgContext) throws AxisFault { if (log.isDebugEnabled()) { log.debug("Acking one-way request"); } // need to skip the ACK till we get the ACK from the actual service for the out-only MEP if ((AddressingHelper.isReplyRedirected(msgContext) && !msgContext.getReplyTo().hasNoneAddress()) || (msgContext.getOperationContext() != null && WSDL2Constants.MEP_URI_IN_ONLY.equals(msgContext.getOperationContext() .getAxisOperation().getMessageExchangePattern()))) { status = RequestResponseTransportStatus.ACKED; msgContext.getOperationContext().setProperty( Constants.RESPONSE_WRITTEN, Constants.VALUE_FALSE); } }
@Override public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault { Object tempObj = inMessage.getProperty(JsonConstant.IS_JSON_STREAM); boolean isJsonStream; if (tempObj != null) { isJsonStream = Boolean.valueOf(tempObj.toString()); } else { // if IS_JSON_STREAM property is not set then it is not a JSON request isJsonStream = false; } if (isJsonStream) { Object o = inMessage.getProperty(JsonConstant.GSON_XML_STREAM_READER); if (o != null) { GsonXMLStreamReader gsonXMLStreamReader = (GsonXMLStreamReader)o; JsonReader jsonReader = gsonXMLStreamReader.getJsonReader(); if (jsonReader == null) { throw new AxisFault("JsonReader should not be null"); } Object serviceObj = getTheImplementationObject(inMessage); AxisOperation op = inMessage.getOperationContext().getAxisOperation(); String operation = op.getName().getLocalPart(); invokeService(jsonReader, serviceObj, operation , outMessage); } else { throw new AxisFault("GsonXMLStreamReader should be put as a property of messageContext " + "to evaluate JSON message"); } } else { super.invokeBusinessLogic(inMessage, outMessage); // call RPCMessageReceiver if inputstream is null } }
private boolean isAckRequired() { // This condition is a bit complex but cannot simplify any further. if (msgContext != null) { if (msgContext.getOperationContext() != null && (!msgContext.getOperationContext().getAxisOperation().isControlOperation() || msgContext.isPropertyTrue(NhttpConstants.FORCE_SC_ACCEPTED))) { return true; } else if (msgContext.isPropertyTrue("NIO-ACK-Requested", false)) { return true; } } return false; }
public MessageContext getAbstractResponseMessageContext(MessageContext requestMessageContext) throws AxisFault { MessageContext outMessageCtx = MessageContextBuilder.createOutMessageContext(requestMessageContext); SOAPFactory factory = getSOAPFactory(requestMessageContext); AxisOperation operation = requestMessageContext.getOperationContext().getAxisOperation(); AxisService service = requestMessageContext.getAxisService(); OMElement bodyContent; AxisMessage outMessage = operation.getMessage(OperationsConstants.OUT); bodyContent = factory.createOMElement(outMessage.getName(), factory.createOMNamespace(namespace, service.getSchemaTargetNamespacePrefix())); try { setPayload(bodyContent); } catch (XMLStreamException e) { String msg = "Error in adding the payload to the response message"; log.error(msg); throw new AxisFault(msg, e); } SOAPEnvelope soapEnvelope = factory.getDefaultEnvelope(); soapEnvelope.getBody().addChild(bodyContent); outMessageCtx.setEnvelope(soapEnvelope); return outMessageCtx; }
/** * @param context The OperationContext */ public void setOperationContext(OperationContext context) { // allow setting the fields to null // useful when extracting the messge context from the object graph operationContext = context; this.setParent(operationContext); if (operationContext != null) { if (serviceContext == null) { setServiceContext(operationContext.getServiceContext()); } else { if (operationContext.getParent() != serviceContext) { throw new AxisError("ServiceContext in OperationContext does not match !"); } } this.setAxisOperation(operationContext.getAxisOperation()); } }
/** * @param context The OperationContext */ public void setOperationContext(OperationContext context) { // allow setting the fields to null // useful when extracting the messge context from the object graph operationContext = context; this.setParent(operationContext); if (operationContext != null) { if (serviceContext == null) { setServiceContext(operationContext.getServiceContext()); } else { if (operationContext.getParent() != serviceContext) { throw new AxisError("ServiceContext in OperationContext does not match !"); } } this.setAxisOperation(operationContext.getAxisOperation()); } }