use of org.apache.axis2.deployment.ServiceBuilder in project carbon-business-process by wso2.
the class AxisServiceUtils method createAxisServiceBuilder.
private static WSDL11ToAxisServiceBuilder createAxisServiceBuilder(BPELProcessProxy processProxy) throws AxisFault {
Definition wsdlDef = processProxy.getWsdlDefinition();
QName serviceName = processProxy.getServiceName();
String portName = processProxy.getPort();
ProcessConf pConf = processProxy.getProcessConfiguration();
QName pid = pConf.getProcessId();
InputStream wsdlInStream = null;
URI wsdlBaseURI = pConf.getBaseURI().resolve(wsdlDef.getDocumentBaseURI());
try {
wsdlInStream = wsdlBaseURI.toURL().openStream();
} catch (MalformedURLException e) {
String errMsg = "Malformed WSDL base URI.";
handleException(pid, errMsg, e);
} catch (IOException e) {
String errMsg = "Error opening stream.";
handleException(pid, errMsg, e);
}
WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisPatchedBuilder(wsdlInStream, serviceName, portName);
serviceBuilder.setBaseUri(wsdlBaseURI.toString());
serviceBuilder.setCustomResolver(new Axis2UriResolver());
try {
serviceBuilder.setCustomWSDLResolver(new Axis2WSDLLocator(wsdlBaseURI));
} catch (URISyntaxException e) {
String errorMessage = "URI syntax invalid.";
handleException(pid, errorMessage, e);
}
serviceBuilder.setServerSide(true);
return serviceBuilder;
}
use of org.apache.axis2.deployment.ServiceBuilder in project carbon-business-process by wso2.
the class AxisServiceUtils method createAxisService.
/**
* Build the underlying Axis Service from Service QName and Port Name of interest using given WSDL
* for BPEL document.
* In the current implementation we are extracting service name from the soap:address' location property.
* But specified port may not contain soap:adress instead it may contains http:address. We need to handle that
* situation.
*
* @param axisConfiguration AxisConfiguration to which we should publish the service
* @param processProxy BPELProcessProxy
* @return Axis Service build using WSDL, Service and Port
* @throws org.apache.axis2.AxisFault on error
*/
public static AxisService createAxisService(AxisConfiguration axisConfiguration, BPELProcessProxy processProxy) throws AxisFault {
QName serviceName = processProxy.getServiceName();
String portName = processProxy.getPort();
Definition wsdlDefinition = processProxy.getWsdlDefinition();
ProcessConf processConfiguration = processProxy.getProcessConfiguration();
if (log.isDebugEnabled()) {
log.debug("Creating AxisService: Service=" + serviceName + " port=" + portName + " WSDL=" + wsdlDefinition.getDocumentBaseURI() + " BPEL=" + processConfiguration.getBpelDocument());
}
WSDL11ToAxisServiceBuilder serviceBuilder = createAxisServiceBuilder(processProxy);
/**
* Need to figure out a way to handle service name extractoin. According to my perspective extracting
* the service name from the EPR is not a good decision. But we need to handle JMS case properly.
* I am keeping JMS handling untouched until we figureout best solution.
*/
/* String axisServiceName = extractServiceName(processConf, wsdlServiceName, portName);*/
AxisService axisService = populateAxisService(processProxy, axisConfiguration, serviceBuilder);
Iterator operations = axisService.getOperations();
BPELMessageReceiver messageRec = new BPELMessageReceiver();
/**
* Set the corresponding BPELService to message receivers
*/
messageRec.setProcessProxy(processProxy);
while (operations.hasNext()) {
AxisOperation operation = (AxisOperation) operations.next();
// Setting WSDLAwareMessage Receiver even if operation has a message receiver specified.
// This is to fix the issue when build service configuration using services.xml(Always RPCMessageReceiver
// is set to operations).
operation.setMessageReceiver(messageRec);
axisConfiguration.getPhasesInfo().setOperationPhases(operation);
}
/**
* TODO: JMS Destination handling.
*/
return axisService;
}
use of org.apache.axis2.deployment.ServiceBuilder in project carbon-business-process by wso2.
the class HumanTaskStore method createAxisService.
// Creates the AxisService object from the provided ServiceBuilder object.
private AxisService createAxisService(WSDL11ToAxisServiceBuilder serviceBuilder, HumanTaskBaseConfiguration config) throws AxisFault {
AxisService axisService;
axisService = serviceBuilder.populateService();
axisService.setParent(getTenantAxisConfig());
axisService.setWsdlFound(true);
axisService.setCustomWsdl(true);
// axisService.setFileName(new URL(taskConfig.getWsdlDefLocation()));
axisService.setClassLoader(getTenantAxisConfig().getServiceClassLoader());
Utils.setEndpointsToAllUsedBindings(axisService);
axisService.addParameter(new Parameter("modifyUserWSDLPortAddress", "true"));
/* Setting service type to use in service management*/
axisService.addParameter(ServerConstants.SERVICE_TYPE, "humantask");
/* Fix for losing of security configuration when updating human-task package*/
axisService.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
Iterator operations = axisService.getOperations();
AxisHumanTaskMessageReceiver msgReceiver = new AxisHumanTaskMessageReceiver();
msgReceiver.setHumanTaskEngine(HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine());
// Setting the task configuration to the message receiver. Hence no need to search for task configuration, when
// the actual task invocation happens, we will already have the task configuration attached to the message receiver
// itself
msgReceiver.setTaskBaseConfiguration(config);
while (operations.hasNext()) {
AxisOperation operation = (AxisOperation) operations.next();
// Setting Message Receiver even if operation has a message receiver specified.
// This is to fix the issue when build service configuration using services.xml(Always RPCMessageReceiver
// is set to operations).
operation.setMessageReceiver(msgReceiver);
getTenantAxisConfig().getPhasesInfo().setOperationPhases(operation);
}
Set<String> exposedTransports = getTenantAxisConfig().getTransportsIn().keySet();
// Add the transports to axis2 service by reading from the tenant transport config
for (String transport : exposedTransports) {
axisService.addExposedTransport(transport);
}
if (HumanTaskServiceComponent.getHumanTaskServer().getServerConfig().isHtCoordinationEnabled() && HumanTaskServiceComponent.getHumanTaskServer().getServerConfig().isTaskRegistrationEnabled() && config.getConfigurationType() == HumanTaskBaseConfiguration.ConfigurationType.TASK) {
// Only Engage coordination module in-case of Tasks. Coordination module is not required for notifications
axisService.engageModule(getConfigContext().getAxisConfiguration().getModule("htcoordination"));
}
return axisService;
}
use of org.apache.axis2.deployment.ServiceBuilder in project carbon-business-process by wso2.
the class HumanTaskStore method createAxisServiceBuilder.
// Creates the AxisServiceBuilder object.
private WSDL11ToAxisServiceBuilder createAxisServiceBuilder(HumanTaskBaseConfiguration taskConfig, Definition wsdlDef) {
WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(wsdlDef, taskConfig.getServiceName(), taskConfig.getPortName());
String wsdlBaseURI = wsdlDef.getDocumentBaseURI();
serviceBuilder.setBaseUri(wsdlBaseURI);
/*we don't need custom resolvers since registry takes care of it*/
serviceBuilder.setCustomResolver(new DefaultURIResolver());
URI wsdlBase = null;
try {
wsdlBase = new URI(convertToVaildURI(wsdlBaseURI));
} catch (Exception e) {
String error = "Error occurred while creating AxisServiceBuilder.";
log.error(error);
}
serviceBuilder.setCustomWSDLResolver(new HumanTaskWSDLLocator(wsdlBase));
serviceBuilder.setServerSide(true);
return serviceBuilder;
}
use of org.apache.axis2.deployment.ServiceBuilder in project wso2-axis2-transports by wso2.
the class ContentTypeRuleTest method setUp.
@Override
public void setUp() throws Exception {
AxisConfiguration axisCfg = new AxisConfiguration();
ConfigurationContext cfgCtx = new ConfigurationContext(axisCfg);
AxisService service = new AxisService();
InputStream in = ContentTypeRuleTest.class.getResourceAsStream(getName() + ".xml");
try {
OMElement element = new StAXOMBuilder(in).getDocumentElement();
new ServiceBuilder(cfgCtx, service).populateService(element);
} finally {
in.close();
}
ruleSet = ContentTypeRuleFactory.parse(service.getParameter("test"));
}
Aggregations