本文整理汇总了Java中org.apache.axis2.context.MessageContext.getAxisService方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.getAxisService方法的具体用法?Java MessageContext.getAxisService怎么用?Java MessageContext.getAxisService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis2.context.MessageContext
的用法示例。
在下文中一共展示了MessageContext.getAxisService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatchAndVerify
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* Finds axis Service and the Operation for DSS requests
*
* @param msgContext request message context
* @throws AxisFault if any exception occurs while finding axis service or operation
*/
private static void dispatchAndVerify(MessageContext msgContext) throws AxisFault {
requestDispatcher.invoke(msgContext);
AxisService axisService = msgContext.getAxisService();
if (axisService != null) {
httpLocationBasedDispatcher.invoke(msgContext);
if (msgContext.getAxisOperation() == null) {
requestURIOperationDispatcher.invoke(msgContext);
}
AxisOperation axisOperation;
if ((axisOperation = msgContext.getAxisOperation()) != null) {
AxisEndpoint axisEndpoint =
(AxisEndpoint) msgContext.getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (axisEndpoint != null) {
AxisBindingOperation axisBindingOperation = (AxisBindingOperation) axisEndpoint
.getBinding().getChild(axisOperation.getName());
msgContext.setProperty(Constants.AXIS_BINDING_OPERATION, axisBindingOperation);
}
msgContext.setAxisOperation(axisOperation);
}
}
}
示例2: getAbstractResponseMessageContext
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
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;
}
示例3: invoke
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* @param msgctx
* @throws org.apache.axis2.AxisFault
*/
public InvocationResponse invoke(MessageContext msgctx) throws AxisFault {
if ((msgctx.getAxisService() != null) && (msgctx.getAxisOperation() == null)) {
AxisOperation axisOperation = findOperation(msgctx.getAxisService(), msgctx);
if (axisOperation != null) {
if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug(msgctx.getLogIDString() + " " + Messages.getMessage("operationfound",
axisOperation
.getName().getLocalPart()));
}
msgctx.setAxisOperation(axisOperation);
//setting axisMessage into messageContext
msgctx.setAxisMessage(axisOperation.getMessage(
WSDLConstants.MESSAGE_LABEL_IN_VALUE));
}
}
return InvocationResponse.CONTINUE;
}
示例4: updateCurrentInvocationStatistic
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private static void updateCurrentInvocationStatistic(MessageContext messageContext,
long responseTime) throws AxisFault {
messageContext.setProperty(StatisticsConstants.GLOBAL_CURRENT_INVOCATION_RESPONSE_TIME,responseTime);
if (messageContext.getAxisOperation() != null) {
Parameter operationResponseTimeParam = new Parameter();
operationResponseTimeParam.setName(StatisticsConstants.OPERATION_RESPONSE_TIME);
operationResponseTimeParam.setValue(responseTime);
messageContext.getAxisOperation().addParameter(operationResponseTimeParam);
}
if (messageContext.getAxisService() != null) {
Parameter serviceResponseTimeParam = new Parameter();
serviceResponseTimeParam.setName(StatisticsConstants.SERVICE_RESPONSE_TIME);
serviceResponseTimeParam.setValue(responseTime);
messageContext.getAxisService().addParameter(serviceResponseTimeParam);
}
}
示例5: validateTransport
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* To check whether the incoming request has come in valid transport , simply the transports
* that service author wants to expose
*
* @param msgctx the current MessageContext
* @throws AxisFault in case of error
*/
private void validateTransport(MessageContext msgctx) throws AxisFault {
AxisService service = msgctx.getAxisService();
if (service.isEnableAllTransports()) {
return;
} else {
List trs = service.getExposedTransports();
String incomingTrs = msgctx.getIncomingTransportName();
//local transport is a special case, it need not be exposed.
if (Constants.TRANSPORT_LOCAL.equals(incomingTrs)) {
return;
}
for (int i = 0; i < trs.size(); i++) {
String tr = (String) trs.get(i);
if (incomingTrs != null && incomingTrs.startsWith(tr)) {
return;
}
}
}
EndpointReference toEPR = msgctx.getTo();
throw new AxisFault(Messages.getMessage("servicenotfoundforepr",
((toEPR != null) ? toEPR.getAddress() : "")));
}
示例6: processDocument
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public OMElement processDocument(DataSource dataSource,
String contentType,
MessageContext msgContext) throws AxisFault {
QName wrapperQName = BaseConstants.DEFAULT_BINARY_WRAPPER;
if (msgContext.getAxisService() != null) {
Parameter wrapperParam = msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM);
if (wrapperParam != null) {
wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue());
}
}
OMFactory factory = OMAbstractFactory.getOMFactory();
OMElement wrapper = factory.createOMElement(wrapperQName, null);
DataHandler dataHandler = new DataHandler(dataSource);
wrapper.addChild(factory.createOMText(dataHandler, true));
msgContext.setDoingMTOM(true);
return wrapper;
}
示例7: canUnderstand
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private static boolean canUnderstand(MessageContext msgContext){
//JAXWSMessageReceiver will only commit to handling must understand if @HandlerChain annotation is present on the
//Endpoint. This will indicate to AxisEngine that Faulty Header names are understood however the mustUnderstand
//Check will be performed in HandlerUtils class after Handlers are injected in application.
AxisService axisSvc = msgContext.getAxisService();
if (axisSvc.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER) != null) {
Parameter param = axisSvc.getParameter(EndpointDescription.AXIS_SERVICE_PARAMETER);
EndpointDescription ed = (EndpointDescription)param.getValue();
//Lets check if there is a Handler implementation present using Metadata layer.
//HandlerChain annotation can be present in Service Endpoint or ServiceEndpointInterface.
// ed.getHandlerChain() looks for HandlerAnnotation at both Endpoint and at SEI.
if(log.isDebugEnabled()){
log.debug("Check to see if a jaxws handler is configured.");
}
if(ed.getHandlerChain()!=null){
return true;
}
return false;
}
else{
//If we cannot get to ServiceDescription to check for HandlerChain annotation we will return true;
return true;
}
}
示例8: checkAction
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* If addressing was found and the dispatch failed we SHOULD (and hence will) return a
* WS-Addressing ActionNotSupported fault. This will make more sense once the
* AddressingBasedDsipatcher is moved into the addressing module
*/
private void checkAction(MessageContext msgContext) throws AxisFault {
if ((msgContext.getAxisService() == null) || (msgContext.getAxisOperation() == null)) {
AddressingFaultsHelper
.triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
}
}
示例9: isEnabled
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private boolean isEnabled(MessageContext mc, String operation) {
if (mc.getAxisService() != null) {
String operationValue =
(String) mc.getAxisService().getParameterValue(operation);
return operationValue == null || !operationValue.toLowerCase().equals(
Boolean.toString(false));
}
return true;
}
示例10: getWrapperQName
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private static QName getWrapperQName(MessageContext msgContext) {
QName wrapperQName = BaseConstants.DEFAULT_TEXT_WRAPPER;
if (msgContext.getAxisService() != null) {
Parameter wrapperParam
= msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM);
if (wrapperParam != null) {
wrapperQName = BaseUtils.getQNameFromString(wrapperParam.getValue());
}
}
return wrapperQName;
}
示例11: getDisableAck
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
private Boolean getDisableAck(MessageContext msgContext) throws AxisFault {
// We should send an early ack to the transport whever possible, but some modules need
// to use the backchannel, so we need to check if they have disabled this code.
Boolean disableAck = (Boolean) msgContext.getProperty(Constants.Configuration.DISABLE_RESPONSE_ACK);
if(disableAck == null) {
disableAck = (Boolean) (msgContext.getAxisService() != null ? msgContext.getAxisService().getParameterValue(Constants.Configuration.DISABLE_RESPONSE_ACK) : null);
}
return disableAck;
}
示例12: testInvokeBusinessLogic
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testInvokeBusinessLogic() throws AxisFault {
ScriptReceiver scriptReceiver = new ScriptReceiver();
MessageContext inMC = TestUtils.createMockMessageContext("<a>petra</a>");
AxisService axisService = inMC.getAxisService();
axisService.addParameter(new Parameter(ScriptReceiver.SCRIPT_ATTR, "foo.js"));
axisService.addParameter(new Parameter(ScriptReceiver.SCRIPT_SRC_PROP,
"function invoke(inMC,outMC) " +
"{outMC.setPayloadXML(<a>petra</a>) }"));
inMC.setAxisService(axisService);
scriptReceiver.invokeBusinessLogic(inMC, inMC);
Iterator iterator = inMC.getEnvelope().getChildElements();
iterator.next();
assertEquals("<a>petra</a>", ((OMElement) iterator.next()).getFirstElement().toString());
}
示例13: testAxisService
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public void testAxisService() throws AxisFault {
ScriptReceiver scriptReceiver = new ScriptReceiver();
MessageContext inMC = TestUtils.createMockMessageContext("<a>petra</a>");
AxisService axisService = inMC.getAxisService();
axisService.addParameter(new Parameter(ScriptReceiver.SCRIPT_ATTR, "foo.js"));
axisService.addParameter(ScriptReceiver.SCRIPT_SRC_PROP,
"var scope = _AxisService.getScope();function invoke(inMC,outMC) " +
"{outMC.setPayloadXML(<a>{scope}</a>) }");
scriptReceiver.invokeBusinessLogic(inMC, inMC);
Iterator iterator = inMC.getEnvelope().getChildElements();
iterator.next();
assertEquals("<a>request</a>", ((OMElement) iterator.next()).getFirstElement().toString());
}
示例14: checkUsingAddressing
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
/**
* Check that if the wsaddressing="required" attribute exists on the service definition
* (or AddressingFeature on the client) or <wsaw:UsingAddressing wsdl:required="true" />
* was found in the WSDL (provider side only) that WS-Addressing headers were found on
* the inbound message.
*/
private void checkUsingAddressing(MessageContext msgContext)
throws AxisFault {
String addressingFlag;
if (!msgContext.isServerSide()) {
// On client side, get required value from the request message context
// (set by AddressingConfigurator).
// We do not use the UsingAddressing required attribute on the
// client side since it is not generated/processed by java tooling.
addressingFlag = AddressingHelper.getRequestAddressingRequirementParameterValue(msgContext);
if (log.isTraceEnabled()) {
log.trace("checkUsingAddressing: WSAddressingFlag from MessageContext=" + addressingFlag);
}
} else {
// On provider side, get required value from AxisOperation
// (set by AddressingConfigurator and UsingAddressing WSDL processing).
AxisDescription ad = msgContext.getAxisService();
if(msgContext.getAxisOperation()!=null){
ad = msgContext.getAxisOperation();
}
addressingFlag =
AddressingHelper.getAddressingRequirementParemeterValue(ad);
if (log.isTraceEnabled()) {
log.trace("checkUsingAddressing: WSAddressingFlag from AxisOperation=" + addressingFlag);
}
}
if (AddressingConstants.ADDRESSING_REQUIRED.equals(addressingFlag)) {
AddressingFaultsHelper.triggerMessageAddressingRequiredFault(msgContext,
AddressingConstants.WSA_ACTION);
}
}
示例15: WSDLAwareSOAPProcessor
import org.apache.axis2.context.MessageContext; //导入方法依赖的package包/类
public WSDLAwareSOAPProcessor(MessageContext inMsgCtx) throws AxisFault {
QName bindingQName;
AxisService axisService;
tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
// Need to solve this one way call scenario
inMessageCtx = inMsgCtx;
axisService = inMsgCtx.getAxisService();
serviceName = new QName(axisService.getTargetNamespace(), axisService.getName());
wsdlDef = (Definition) axisService.getParameter(WSDL_4_J_DEFINITION).getValue();
if (wsdlDef == null) {
throw new AxisFault("No WSDL Definition was found for service " +
serviceName.getLocalPart() + ".");
}
Service wsdlServiceDef = wsdlDef.getService(serviceName);
if (wsdlServiceDef == null) {
throw new AxisFault("WSDL Service Definition not found for service " +
serviceName.getLocalPart());
}
/**
* This will get the current end point which Axis2 picks the incoming request.
*/
AxisEndpoint axisEndpoint = (AxisEndpoint) inMsgCtx.
getProperty(WSDL2Constants.ENDPOINT_LOCAL_NAME);
if (axisEndpoint == null) {
String defaultEndpointName = axisService.getEndpointName();
axisEndpoint = axisService.getEndpoints().get(defaultEndpointName);
if (axisEndpoint == null) {
throw new AxisFault("AxisEndpoint cannot be null.");
}
}
portName = axisEndpoint.getName();
AxisBinding axisBinding = axisEndpoint.getBinding();
bindingQName = axisBinding.getName();
/** In this implementation, we assume that AxisBinding's QName is equal to WSDL bindings QName. */
wsdlBinding = wsdlDef.getBinding(bindingQName);
if (wsdlBinding == null) {
throw new AxisFault("WSDL Binding null for incoming message.");
}
ExtensibilityElement bindingType = getBindingExtension(wsdlBinding);
if (!(bindingType instanceof SOAPBinding || bindingType instanceof SOAP12Binding ||
bindingType instanceof HTTPBinding)) {
throw new AxisFault("WSDL Binding not supported.");
}
isRPC = isRPC(bindingType);
soapFactory = (SOAPFactory) inMsgCtx.getEnvelope().getOMFactory();
if (soapFactory == null) {
if (bindingType instanceof SOAPBinding) {
soapFactory = OMAbstractFactory.getSOAP11Factory();
} else {
soapFactory = OMAbstractFactory.getSOAP12Factory();
}
}
}