use of javax.wsdl.Definition in project pentaho-platform by pentaho.
the class AxisUtil method createServiceWsdl.
/**
* Creates the WSDL for an Axis service
*
* @param axisService
* @param wrapper
* @throws Exception
*/
public static void createServiceWsdl(AxisService axisService, IServiceConfig wsDef, AxisConfiguration axisConfig) throws Exception {
// specific that we are generating the WSDL
Parameter useOriginalwsdl = new Parameter();
// $NON-NLS-1$
useOriginalwsdl.setName("useOriginalwsdl");
// $NON-NLS-1$
useOriginalwsdl.setValue("true");
axisService.addParameter(useOriginalwsdl);
// get the WSDL generation and make it a parameter
Definition wsdlDefn = AxisUtil.getWsdlDefinition(axisConfig, wsDef);
Parameter wsdl = new Parameter();
wsdl.setName(WSDLConstants.WSDL_4_J_DEFINITION);
wsdl.setValue(wsdlDefn);
// add the WSDL parameter to the service
axisService.addParameter(wsdl);
}
use of javax.wsdl.Definition 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 javax.wsdl.Definition 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 javax.wsdl.Definition in project carbon-business-process by wso2.
the class BPELMessageContextFactory method getWSDLDefinitionFromAxisService.
private static Definition getWSDLDefinitionFromAxisService(final AxisService service) {
Definition wsdlDefinition = (Definition) service.getParameter(BPELConstants.WSDL_4_J_DEFINITION).getValue();
QName serviceName = new QName(service.getTargetNamespace(), service.getName());
if (wsdlDefinition == null) {
throw new NullPointerException("No WSDL Definition was found for service " + serviceName.getLocalPart() + ".");
}
checkWhetherServiceDefinitionIsAvailable(wsdlDefinition, serviceName);
return wsdlDefinition;
}
use of javax.wsdl.Definition in project carbon-business-process by wso2.
the class BPELBindingContextImpl method createPartnerService.
private PartnerService createPartnerService(ProcessConf pConf, QName serviceName, String portName) throws ContextException {
PartnerService partnerService;
Definition def = pConf.getDefinitionForService(serviceName);
try {
if (log.isDebugEnabled()) {
log.debug("Creating external service " + serviceName);
}
partnerService = new PartnerService(def, serviceName, portName, getConfigurationContextFromProcessConfiguration(pConf), pConf, bpelServer.getHttpConnectionManager());
} catch (Exception ex) {
throw new ContextException("Error creating external service! name:" + serviceName + ", port:" + portName, ex);
}
// if not SOAP nor HTTP binding
if (partnerService == null) {
throw new ContextException("Only SOAP and HTTP binding supported!");
}
if (log.isDebugEnabled()) {
log.debug("Created external service " + serviceName);
}
return partnerService;
}
Aggregations