Search in sources :

Example 6 with WSDL11ToAxisServiceBuilder

use of org.apache.axis2.description.WSDL11ToAxisServiceBuilder in project carbon-business-process by wso2.

the class HumanTaskStore method validateServiceCreationForTaskConfig.

/**
 * When wsdl errors are there in the package, we use a dummy service creation step to validate all required parts
 * are available in the wsdl
 * @param taskConfig Task configuration object for this task package
 * @throws HumanTaskDeploymentException HumanTaskDeployment Exception is thrown when an error happens
 */
private void validateServiceCreationForTaskConfig(HumanTaskBaseConfiguration taskConfig) throws HumanTaskDeploymentException {
    try {
        WSDL11ToAxisServiceBuilder serviceBuilder = createAxisServiceBuilder(taskConfig, taskConfig.getWSDL());
        serviceBuilder.populateService();
    } catch (AxisFault e) {
        String errorMsg = "Error validating wsdl " + e.getMessage();
        throw new HumanTaskDeploymentException(errorMsg, e);
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) WSDL11ToAxisServiceBuilder(org.apache.axis2.description.WSDL11ToAxisServiceBuilder) HumanTaskDeploymentException(org.wso2.carbon.humantask.core.deployment.HumanTaskDeploymentException)

Example 7 with WSDL11ToAxisServiceBuilder

use of org.apache.axis2.description.WSDL11ToAxisServiceBuilder in project carbon-business-process by wso2.

the class HumanTaskStore method deploy.

private void deploy(HumanTaskBaseConfiguration taskConfig) throws HumanTaskDeploymentException {
    if (taskConfig != null) {
        /**
         * Creating AxisService for HI
         */
        if (log.isDebugEnabled()) {
            log.debug("Deploying task " + taskConfig.getName());
        }
        AxisService axisService;
        Definition wsdlDef = taskConfig.getWSDL();
        if (taskConfig instanceof TaskConfiguration) {
            // to get the task id as response
            wsdlDef.getPortType(taskConfig.getPortType()).getOperation(taskConfig.getOperation(), null, null).setStyle(OperationType.REQUEST_RESPONSE);
        } else {
            // ONE_WAY no feed back for NOTIFICATIONS
            wsdlDef.getPortType(taskConfig.getPortType()).getOperation(taskConfig.getOperation(), null, null).setStyle(OperationType.ONE_WAY);
        }
        WSDL11ToAxisServiceBuilder serviceBuilder = createAxisServiceBuilder(taskConfig, wsdlDef);
        try {
            axisService = createAxisService(serviceBuilder, taskConfig);
            ServiceConfigurationUtil.configureService(axisService, taskConfig.getEndpointConfiguration(taskConfig.getServiceName().getLocalPart(), taskConfig.getPortName()), getConfigContext());
            ArrayList<AxisService> serviceList = new ArrayList<AxisService>();
            serviceList.add(axisService);
            DeploymentEngine.addServiceGroup(createServiceGroupForService(axisService), serviceList, null, null, getTenantAxisConfig());
            if (log.isDebugEnabled()) {
                log.debug(" Published axis2 service " + axisService.getName() + " for task " + taskConfig.getName());
            }
        } catch (AxisFault axisFault) {
            String errMsg = "Error populating the service";
            log.error(errMsg);
            throw new HumanTaskDeploymentException(errMsg, axisFault);
        }
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) AxisService(org.apache.axis2.description.AxisService) Definition(javax.wsdl.Definition) ArrayList(java.util.ArrayList) WSDL11ToAxisServiceBuilder(org.apache.axis2.description.WSDL11ToAxisServiceBuilder) HumanTaskDeploymentException(org.wso2.carbon.humantask.core.deployment.HumanTaskDeploymentException)

Example 8 with WSDL11ToAxisServiceBuilder

use of org.apache.axis2.description.WSDL11ToAxisServiceBuilder in project carbon-business-process by wso2.

the class AxisServiceUtils method populateAxisService.

private static AxisService populateAxisService(BPELProcessProxy processProxy, AxisConfiguration axisConfiguration, WSDL11ToAxisServiceBuilder serviceBuilder) throws AxisFault {
    ProcessConf pConf = processProxy.getProcessConfiguration();
    AxisService axisService = serviceBuilder.populateService();
    axisService.setParent(axisConfiguration);
    axisService.setWsdlFound(true);
    axisService.setCustomWsdl(true);
    axisService.setClassLoader(axisConfiguration.getServiceClassLoader());
    URL wsdlUrl = null;
    for (File file : pConf.getFiles()) {
        if (file.getAbsolutePath().indexOf(processProxy.getWsdlDefinition().getDocumentBaseURI()) > 0) {
            try {
                wsdlUrl = file.toURI().toURL();
            } catch (MalformedURLException e) {
                String errorMessage = "Cannot convert File URI to URL.";
                handleException(pConf.getProcessId(), errorMessage, e);
            }
        }
    }
    if (wsdlUrl != null) {
        axisService.setFileName(wsdlUrl);
    }
    Utils.setEndpointsToAllUsedBindings(axisService);
    axisService.addParameter(new Parameter("useOriginalwsdl", "true"));
    axisService.addParameter(new Parameter("modifyUserWSDLPortAddress", "true"));
    axisService.addParameter(new Parameter("setEndpointsToAllUsedBindings", "true"));
    /* Setting service type to use in service management*/
    axisService.addParameter(ServerConstants.SERVICE_TYPE, "bpel");
    /* Process ID as a service parameter to use with process try-it*/
    axisService.addParameter(BPELConstants.PROCESS_ID, pConf.getProcessId());
    /* Fix for losing of security configuration  when updating BPEL package*/
    axisService.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
    return axisService;
}
Also used : MalformedURLException(java.net.MalformedURLException) ProcessConf(org.apache.ode.bpel.iapi.ProcessConf) AxisService(org.apache.axis2.description.AxisService) Parameter(org.apache.axis2.description.Parameter) File(java.io.File) URL(java.net.URL)

Aggregations

WSDL11ToAxisServiceBuilder (org.apache.axis2.description.WSDL11ToAxisServiceBuilder)5 AxisService (org.apache.axis2.description.AxisService)4 MalformedURLException (java.net.MalformedURLException)3 Definition (javax.wsdl.Definition)3 AxisFault (org.apache.axis2.AxisFault)3 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)3 HumanTaskDeploymentException (org.wso2.carbon.humantask.core.deployment.HumanTaskDeploymentException)3 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 URI (java.net.URI)2 URL (java.net.URL)2 Iterator (java.util.Iterator)2 QName (javax.xml.namespace.QName)2 AxisOperation (org.apache.axis2.description.AxisOperation)2 Parameter (org.apache.axis2.description.Parameter)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1