Search in sources :

Example 16 with Integer

use of org.apache.axis2.databinding.types.soapencoding.Integer in project pentaho-platform by pentaho.

the class AbstractAxisServiceContentGenerator method processAxisFault.

/**
 * Handles processing of Axis exceptions.
 *
 * @param msgContext
 *          The message context that experienced an error
 * @param out
 *          The output stream to write to
 * @param e
 *          The error that occurred
 */
protected void processAxisFault(MessageContext msgContext, OutputStream out, Throwable e) {
    // $NON-NLS-1$
    IParameterProvider pathParams = parameterProviders.get("path");
    // is this HTTP?
    boolean http = msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE) != null;
    if (http) {
        // $NON-NLS-1$
        HttpServletResponse res = (HttpServletResponse) pathParams.getParameter("httpresponse");
        // If the fault is not going along the back channel we should be 202ing
        if (AddressingHelper.isFaultRedirected(msgContext)) {
            res.setStatus(HttpServletResponse.SC_ACCEPTED);
        } else {
            // set the status of the HTTP response
            String status = (String) msgContext.getProperty(Constants.HTTP_RESPONSE_STATE);
            try {
                if (status == null) {
                    res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                } else {
                    int sc = Integer.parseInt(status);
                    if (sc >= 400) {
                        res.sendError(sc);
                    } else {
                        res.setStatus(sc);
                    }
                }
            } catch (IOException e1) {
                if (status == null) {
                    res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
                } else {
                    int sc = Integer.parseInt(status);
                    res.setStatus(sc);
                }
            }
            AxisBindingOperation axisBindingOperation = (AxisBindingOperation) msgContext.getProperty(Constants.AXIS_BINDING_OPERATION);
            if (axisBindingOperation != null) {
                AxisBindingMessage fault = axisBindingOperation.getFault((String) msgContext.getProperty(Constants.FAULT_NAME));
                if (fault != null) {
                    Integer code = (Integer) fault.getProperty(WSDL2Constants.ATTR_WHTTP_CODE);
                    if (code != null) {
                        res.setStatus(code.intValue());
                    }
                }
            }
        }
    }
    try {
        // now process the fault
        handleFault(msgContext, out, http, e);
    } catch (IOException axisFault) {
        // $NON-NLS-1$
        String message = Messages.getInstance().getErrorString("WebServiceContentGenerator.ERROR_0003_PROCESSING_FAULT");
        getLogger().error(message, axisFault);
    }
}
Also used : IParameterProvider(org.pentaho.platform.api.engine.IParameterProvider) HttpServletResponse(javax.servlet.http.HttpServletResponse) AxisBindingOperation(org.apache.axis2.description.AxisBindingOperation) AxisBindingMessage(org.apache.axis2.description.AxisBindingMessage) IOException(java.io.IOException)

Example 17 with Integer

use of org.apache.axis2.databinding.types.soapencoding.Integer in project carbon-business-process by wso2.

the class BPELBindingContextImpl method deactivateMyRoleEndpoint.

public void deactivateMyRoleEndpoint(QName processID, Endpoint endpoint) {
    if (log.isDebugEnabled()) {
        log.debug("Deactivating my role endpoint for process: " + processID + " service: " + endpoint.serviceName + " and port: " + endpoint.portName);
    }
    Integer tenantId = bpelServer.getMultiTenantProcessStore().getTenantId(processID);
    BPELProcessProxy processProxy = getBPELProcessProxy(tenantId.toString(), endpoint.serviceName, endpoint.portName);
    if (processProxy != null) {
        ProcessConfigurationImpl processConf = (ProcessConfigurationImpl) processProxy.getProcessConfiguration();
        if (processConf.isUndeploying()) {
            AxisService service = processProxy.getAxisService();
            Parameter param = service.getParameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM);
            param.setValue("false");
        }
        removeBPELProcessProxyAndAxisService(tenantId.toString(), endpoint.serviceName, endpoint.portName);
        updateServiceList(((ProcessConfigurationImpl) processProxy.getProcessConfiguration()).getTenantId(), endpoint, STATE.REMOVE);
        serviceEprMap.remove(processProxy);
    }
// else this method also get called for the retired processes where there could be an
// active version of the same process type. Since there is only one service for a
// particular process type, processProxy will be null for all the endpoints except for 1.
}
Also used : AxisService(org.apache.axis2.description.AxisService) Parameter(org.apache.axis2.description.Parameter) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)

Example 18 with Integer

use of org.apache.axis2.databinding.types.soapencoding.Integer in project carbon-business-process by wso2.

the class BPMNDeployer method undeploy.

/**
 * Undeployment operation for Bpmn Deployer
 *
 * @param bpmnArchivePath        archivePatch
 * @throws DeploymentException   Deployment failure will result in this exception
 */
public void undeploy(String bpmnArchivePath) throws DeploymentException {
    if (isWorkerNode()) {
        return;
    }
    if (System.getProperty(BPMNConstants.RESOLVE_DEPLOYMENT_SYS_PROP) != null && Boolean.parseBoolean(System.getProperty(BPMNConstants.RESOLVE_DEPLOYMENT_SYS_PROP)) || System.getProperty(BPMNConstants.RESOLVE_DEPLOYMENT_SYS_PROP) == null) {
        File bpmnArchiveFile = new File(bpmnArchivePath);
        if (bpmnArchiveFile.exists()) {
            if (log.isTraceEnabled()) {
                log.trace("BPMN package: " + bpmnArchivePath + " exists in the deployment folder. " + "Therefore, this can be an update of the package and the undeployment will be aborted.");
            }
            return;
        }
        Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        log.info("Undeploying BPMN archive " + bpmnArchivePath + " for tenant: " + tenantId);
        String deploymentName = FilenameUtils.getBaseName(bpmnArchivePath);
        try {
            tenantRepository.undeploy(deploymentName, true);
        } catch (BPSFault be) {
            String errorMsg = "Error un deploying BPMN Package " + deploymentName;
            throw new DeploymentException(errorMsg, be);
        }
    }
}
Also used : BPSFault(org.wso2.carbon.bpmn.core.BPSFault) DeploymentException(org.apache.axis2.deployment.DeploymentException) File(java.io.File)

Example 19 with Integer

use of org.apache.axis2.databinding.types.soapencoding.Integer in project carbon-business-process by wso2.

the class BPELProcessProxy method createMessageExchange.

private MyRoleMessageExchange createMessageExchange(final MessageContext inMessageContext) {
    Integer tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
    MyRoleMessageExchange messageExchange;
    String messageId = new GUID().toString();
    messageExchange = odeBpelServer.getEngine().createMessageExchange("" + messageId, serviceName, inMessageContext.getAxisOperation().getName().getLocalPart(), null, tenantId.toString());
    if (log.isDebugEnabled()) {
        log.debug("ODE routed to portType " + messageExchange.getPortType() + " operation " + messageExchange.getOperation() + " from service " + serviceName);
    }
    messageExchange.setProperty("isTwoWay", Boolean.toString(inMessageContext.getAxisOperation() instanceof TwoChannelAxisOperation));
    return messageExchange;
}
Also used : MyRoleMessageExchange(org.apache.ode.bpel.iapi.MyRoleMessageExchange) TwoChannelAxisOperation(org.apache.axis2.description.TwoChannelAxisOperation) GUID(org.apache.ode.utils.GUID)

Aggregations

IOException (java.io.IOException)4 OMElement (org.apache.axiom.om.OMElement)4 MessageContext (org.apache.axis2.context.MessageContext)4 Parameter (org.apache.axis2.description.Parameter)4 QName (javax.xml.namespace.QName)3 DeploymentException (org.apache.axis2.deployment.DeploymentException)3 Pipe (org.apache.synapse.transport.passthru.Pipe)3 File (java.io.File)2 OutputStream (java.io.OutputStream)2 ArrayList (java.util.ArrayList)2 Iterator (java.util.Iterator)2 Map (java.util.Map)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 OMOutputFormat (org.apache.axiom.om.OMOutputFormat)2 AxisFault (org.apache.axis2.AxisFault)2 TransportInDescription (org.apache.axis2.description.TransportInDescription)2 MessageFormatter (org.apache.axis2.transport.MessageFormatter)2 NHttpServerConnection (org.apache.http.nio.NHttpServerConnection)2 Message (quickfix.Message)2 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1