protected Map lookup(AxisOperation axisOperation) { Map axisMessageMap = new HashMap(); if (axisOperation instanceof InOnlyAxisOperation) { axisMessageMap.put(WSDLConstants.MESSAGE_LABEL_IN_VALUE, axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE)); return axisMessageMap; } else if (axisOperation instanceof OutOnlyAxisOperation) { axisMessageMap.put(WSDLConstants.MESSAGE_LABEL_OUT_VALUE, axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); return axisMessageMap; } else if (axisOperation instanceof TwoChannelAxisOperation) { axisMessageMap.put(WSDLConstants.MESSAGE_LABEL_IN_VALUE, axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE)); axisMessageMap.put(WSDLConstants.MESSAGE_LABEL_OUT_VALUE, axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); return axisMessageMap; } else { return axisMessageMap; } } }
/** * This method is used for adding documentation for the message types of the service operations * eg: input message * output message * fault messages * * @param axisOperation * @param documentationElement * @param messageLabel */ private void addMessageDocumentation(AxisOperation axisOperation, Element documentationElement, String messageLabel) { if ((documentationElement != null) && (documentationElement.getFirstChild() != null)) { Node firstChild = documentationElement.getFirstChild(); String documentation = DOM2Writer.nodeToString(firstChild); if (!"".equals(documentation)) { (axisOperation.getMessage(messageLabel)).setDocumentation(documentation); } } }
/** * This method is used for adding documentation for the message types of the service operations * eg: input message * output message * fault messages * * @param axisOperation * @param documentationElement * @param messageLabel */ private void addMessageDocumentation(AxisOperation axisOperation, Element documentationElement, String messageLabel) { if ((documentationElement != null) && (documentationElement.getFirstChild() != null)) { Node firstChild = documentationElement.getFirstChild(); String documentation = DOM2Writer.nodeToString(firstChild); if (!"".equals(documentation)) { (axisOperation.getMessage(messageLabel)).setDocumentation(documentation); } } }
public static MessageContext generateAxisFaultMessageContext(MessageContext msgContext, Throwable e) throws AxisFault { // MessageContext faultContext = MessageContextBuilder.createFaultMessageContext( msgContext, e ); // set the Axis Message as the out message if a fault message is not // there //TODO: set the fault message it is available. AxisOperation axisOperation = msgContext.getAxisOperation(); if (axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE) != null){ faultContext.setAxisMessage(axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); } else { faultContext.setAxisMessage(axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE)); } faultContext.setProperty("RECV_RESULTS", msgContext.getProperty("RECV_RESULTS")); // set the servlet transport property faultContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, msgContext.getProperty( HTTPConstants.MC_HTTP_SERVLETRESPONSE)); return faultContext; }
private AxisOperation processOperationValidation(AxisService proxyService) throws AxisFault { AxisOperation mediateOperation = new InOutAxisOperation( SynapseConstants.SYNAPSE_OPERATION_NAME); // Set the names of the two messages so that Axis2 is able to produce a WSDL (see SYNAPSE-366): mediateOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).setName("in"); mediateOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).setName("out"); // create a custom message receiver for this proxy service ProxyServiceMessageReceiver msgRcvr = new ProxyServiceMessageReceiver(); msgRcvr.setName(name); msgRcvr.setProxy(this); mediateOperation.setMessageReceiver(msgRcvr); mediateOperation.setParent(proxyService); proxyService.addParameter("_default_mediate_operation_", mediateOperation); return mediateOperation; }
private void sendRobust(org.apache.axis2.context.MessageContext axisOutMsgCtx, Options clientOptions, AxisService anonymousService, ServiceContext serviceCtx) throws AxisFault { AxisOperation axisAnonymousOperation = anonymousService.getOperation( new QName(AnonymousServiceFactory.OUT_ONLY_OPERATION)); OperationClient operationClient = axisAnonymousOperation.createClient( serviceCtx, clientOptions); operationClient.addMessageContext(axisOutMsgCtx); axisOutMsgCtx.setAxisMessage(axisAnonymousOperation.getMessage( WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); operationClient.execute(true); axisOutMsgCtx.getTransportOut().getSender().cleanup(axisOutMsgCtx); }
private void populateAxisService() throws org.apache.axis2.AxisFault { //creating the Service with a unique name _service = new org.apache.axis2.description.AxisService("ServicoConsultarLoteEventos" + getUniqueSuffix()); addAnonymousOperations(); //creating the operations org.apache.axis2.description.AxisOperation __operation; _operations = new org.apache.axis2.description.AxisOperation[1]; __operation = new org.apache.axis2.description.OutInAxisOperation(); __operation.setName(new javax.xml.namespace.QName("http://www.esocial.gov.br/servicos/empregador/lote/eventos/envio/consulta/retornoProcessamento/v1_1_0", "consultarLoteEventos")); _service.addOperation(__operation); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"Servicos.Empregador_ServicoConsultarLoteEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>")); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"Servicos.Empregador_ServicoConsultarLoteEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>")); _operations[0]=__operation; }
private void populateAxisService() throws org.apache.axis2.AxisFault { //creating the Service with a unique name _service = new org.apache.axis2.description.AxisService("ServicoEnviarLoteEventos" + getUniqueSuffix()); addAnonymousOperations(); //creating the operations org.apache.axis2.description.AxisOperation __operation; _operations = new org.apache.axis2.description.AxisOperation[1]; __operation = new org.apache.axis2.description.OutInAxisOperation(); __operation.setName(new javax.xml.namespace.QName("http://www.esocial.gov.br/servicos/empregador/lote/eventos/envio/v1_1_0", "enviarLoteEventos")); _service.addOperation(__operation); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"WsEnviarLoteEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>")); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"WsEnviarLoteEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>")); _operations[0]=__operation; }
/** * @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; } }
/** * @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; } }
(__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"ServicoSolicitarDownloadEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>")); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"ServicoSolicitarDownloadEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>")); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"ServicoSolicitarDownloadEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>")); (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy wsu:Id=\"ServicoSolicitarDownloadEventos_policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:TransportBinding xmlns:sp=\"http://schemas.xmlsoap.org/ws/2005/07/securitypolicy\"><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:TransportToken><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:HttpsToken RequireClientCertificate=\"true\"></sp:HttpsToken></wsp:Policy></sp:TransportToken><sp:AlgorithmSuite><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Basic256 /></wsp:Policy></sp:AlgorithmSuite><sp:Layout><wsp:Policy xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"><sp:Strict /></wsp:Policy></sp:Layout></wsp:Policy></sp:TransportBinding></wsp:All></wsp:ExactlyOne></wsp:Policy>"));
private void applyPolicies(Axis2WireSourceDefinition pwsd, AxisService axisService) throws WiringException, AxisFault { for (Iterator<?> i = axisService.getOperations(); i.hasNext();) { AxisOperation axisOperation = (AxisOperation) i.next(); String operation = axisOperation.getName().getLocalPart(); Set<AxisPolicy> policies = pwsd.getPolicies(operation); if (policies == null || policies.size() == 0) { continue; } AxisDescription axisDescription = axisOperation; for (AxisPolicy axisPolicy : policies) { String message = axisPolicy.getMessage(); String module = axisPolicy.getModule(); Element opaquePolicy = axisPolicy.getOpaquePolicy(); AxisModule axisModule = f3Configurator.getModule(module); axisOperation.addModule(axisModule.getName()); axisOperation.engageModule(axisModule); if (message != null) { axisDescription = axisOperation.getMessage(message); } policyApplier.applyPolicy(axisDescription, opaquePolicy); } } }
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; }
private void processMessages(Iterator messages, AxisOperation operation) throws DeploymentException { while (messages.hasNext()) { OMElement messageElement = (OMElement) messages.next(); OMAttribute label = messageElement .getAttribute(new QName(TAG_LABEL)); if (label == null) { throw new DeploymentException(Messages .getMessage("messagelabelcannotfound")); } AxisMessage message = operation.getMessage(label .getAttributeValue()); Iterator<OMElement> parameters = messageElement.getChildrenWithName(new QName( TAG_PARAMETER)); // processing <wsp:Policy> .. </..> elements Iterator<OMElement> policyElements = PolicyUtil.getPolicyChildren(messageElement); if (policyElements != null) { processPolicyElements(policyElements, message.getPolicySubject()); } // processing <wsp:PolicyReference> .. </..> elements Iterator<OMElement> policyRefElements = PolicyUtil.getPolicyRefChildren(messageElement); if (policyRefElements != null) { processPolicyRefElements(policyRefElements, message.getPolicySubject()); } processParameters(parameters, message, operation); } }
private void processMessages(Iterator messages, AxisOperation operation) throws DeploymentException { while (messages.hasNext()) { OMElement messageElement = (OMElement) messages.next(); OMAttribute label = messageElement .getAttribute(new QName(TAG_LABEL)); if (label == null) { throw new DeploymentException(Messages .getMessage("messagelabelcannotfound")); } AxisMessage message = operation.getMessage(label .getAttributeValue()); Iterator parameters = messageElement.getChildrenWithName(new QName( TAG_PARAMETER)); // processing <wsp:Policy> .. </..> elements Iterator policyElements = PolicyUtil.getPolicyChildren(messageElement); if (policyElements != null) { processPolicyElements(policyElements, message.getPolicySubject()); } // processing <wsp:PolicyReference> .. </..> elements Iterator policyRefElements = PolicyUtil.getPolicyRefChildren(messageElement); if (policyRefElements != null) { processPolicyRefElements(policyRefElements, message.getPolicySubject()); } processParameters(parameters, message, operation); } }
private void sendRobust(org.apache.axis2.context.MessageContext axisOutMsgCtx, Options clientOptions, AxisService anonymousService, ServiceContext serviceCtx, MessageContext synapseInMsgCtx) throws AxisFault { this.invokeHandlers(synapseInMsgCtx, false); AxisOperation axisAnonymousOperation = anonymousService.getOperation(new QName(AnonymousServiceFactory.OUT_ONLY_OPERATION)); OperationClient operationClient = axisAnonymousOperation.createClient(serviceCtx, clientOptions); operationClient.addMessageContext(axisOutMsgCtx); axisOutMsgCtx.setAxisMessage( axisAnonymousOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); operationClient.execute(true); axisOutMsgCtx.getTransportOut().getSender().cleanup(axisOutMsgCtx); }
private org.apache.axis2.context.MessageContext sendReceive(org.apache.axis2.context.MessageContext axisOutMsgCtx, Options clientOptions, AxisService anonymousService, ServiceContext serviceCtx) throws AxisFault { AxisOperation axisAnonymousOperation = anonymousService.getOperation( new QName(AnonymousServiceFactory.OUT_IN_OPERATION)); OperationClient operationClient = axisAnonymousOperation.createClient( serviceCtx, clientOptions); operationClient.addMessageContext(axisOutMsgCtx); axisOutMsgCtx.setAxisMessage(axisAnonymousOperation.getMessage( WSDLConstants.MESSAGE_LABEL_OUT_VALUE)); operationClient.execute(true); org.apache.axis2.context.MessageContext resultMsgCtx = operationClient.getMessageContext( WSDLConstants.MESSAGE_LABEL_IN_VALUE); org.apache.axis2.context.MessageContext returnMsgCtx = new org.apache.axis2.context.MessageContext(); returnMsgCtx.setEnvelope(MessageHelper.cloneSOAPEnvelope(resultMsgCtx.getEnvelope())); returnMsgCtx.setProperty(SynapseConstants.HTTP_SENDER_STATUSCODE, resultMsgCtx.getProperty(SynapseConstants.HTTP_SENDER_STATUSCODE)); axisOutMsgCtx.getTransportOut().getSender().cleanup(axisOutMsgCtx); return returnMsgCtx; }
public MessageContext createMessageContext() throws AxisFault { MessageContext msgContext = listener.createMessageContext(); if (service != null) { msgContext.setAxisService(service); // find the operation for the message, or default to one Parameter operationParam = service.getParameter(BaseConstants.OPERATION_PARAM); QName operationQName = ( operationParam != null ? BaseUtils.getQNameFromString(operationParam.getValue()) : BaseConstants.DEFAULT_OPERATION); AxisOperation operation = service.getOperation(operationQName); if (operation != null) { msgContext.setAxisOperation(operation); msgContext.setAxisMessage( operation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN)); msgContext.setSoapAction("urn:" + operation.getName().getLocalPart()); } } return msgContext; } }
public MessageContext createMessageContext() throws AxisFault { MessageContext msgContext = listener.createMessageContext(); if (service != null) { msgContext.setAxisService(service); // find the operation for the message, or default to one Parameter operationParam = service.getParameter(BaseConstants.OPERATION_PARAM); QName operationQName = ( operationParam != null ? BaseUtils.getQNameFromString(operationParam.getValue()) : BaseConstants.DEFAULT_OPERATION); AxisOperation operation = service.getOperation(operationQName); if (operation != null) { msgContext.setAxisOperation(operation); msgContext.setAxisMessage( operation.getMessage(WSDL2Constants.MESSAGE_LABEL_IN)); msgContext.setSoapAction("urn:" + operation.getName().getLocalPart()); } } return msgContext; } }
private void applyPolicies(ServiceClient sender, String operation) throws AxisFault { if (policies == null) { return; } AxisService axisService = sender.getAxisService(); AxisOperation axisOperation = axisService.getOperationBySOAPAction("urn:" + operation); if (axisOperation == null) { axisOperation = axisService.getOperation(ServiceClient.ANON_OUT_IN_OP); } AxisDescription axisDescription = axisOperation; for (AxisPolicy policy : policies) { String moduleName = policy.getModule(); String message = policy.getMessage(); AxisModule axisModule = f3Configurator.getModule(moduleName); axisOperation.addModule(axisModule.getName()); axisOperation.engageModule(axisModule); if (message != null) { axisDescription = axisOperation.getMessage(message); } policyApplier.applyPolicy(axisDescription, policy.getOpaquePolicy()); } }