use of org.apache.axis2.deployment.ServiceBuilder in project carbon-business-process by wso2.
the class ServiceConfigurationUtil method configureService.
public static void configureService(AxisService axisService, EndpointConfiguration endpointConf, ConfigurationContext configCtx) throws AxisFault {
if (endpointConf != null && endpointConf.isServiceDescriptionAvailable() && StringUtils.isNotEmpty(endpointConf.getServiceDescriptionLocation())) {
OMElement documentEle = getServiceElement(endpointConf);
if (documentEle != null) {
if (log.isDebugEnabled()) {
log.debug("Configuring service " + axisService.getName() + " using: " + endpointConf.getServiceDescriptionLocation());
}
ServiceBuilder builder = new ServiceBuilder(configCtx, axisService);
Iterator itr = documentEle.getChildElements();
while (itr.hasNext()) {
OMElement serviceEle = (OMElement) itr.next();
if (serviceEle.getLocalName().toLowerCase().equals("service")) {
if (serviceEle.getAttribute(new QName("name")) != null && serviceEle.getAttribute(new QName("name")).getAttributeValue().equals(axisService.getName())) {
builder.populateService(serviceEle);
// This is a hack to avoid security configurations get persisted when we configure using
// services.xml file or policy.xml file BPEL package. But this should be fix at the
// Carbon Persistence manager.
Parameter param = new Parameter(BusinessProcessConstants.CONFIGURED_USING_BPEL_PKG_CONFIG_FILES, "true");
axisService.addParameter(param);
}
}
}
}
}
}
use of org.apache.axis2.deployment.ServiceBuilder 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);
}
}
use of org.apache.axis2.deployment.ServiceBuilder 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);
}
}
}
use of org.apache.axis2.deployment.ServiceBuilder 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;
}
Aggregations