use of javax.wsdl.BindingOperation in project tdi-studio-se by Talend.
the class ComponentBuilder method buildOperation.
private OperationInfo buildOperation(OperationInfo operationInfo, BindingOperation bindingOper) {
Operation oper = bindingOper.getOperation();
operationInfo.setTargetMethodName(oper.getName());
Vector operElems = findExtensibilityElement(bindingOper.getExtensibilityElements(), "operation");
ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
if (operElem != null && operElem instanceof SOAPOperation) {
SOAPOperation soapOperation = (SOAPOperation) operElem;
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
} else if (operElem != null && operElem instanceof SOAP12Operation) {
SOAP12Operation soapOperation = (SOAP12Operation) operElem;
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
}
BindingInput bindingInput = bindingOper.getBindingInput();
BindingOutput bindingOutput = bindingOper.getBindingOutput();
Vector bodyElems = findExtensibilityElement(bindingInput.getExtensibilityElements(), "body");
ExtensibilityElement bodyElem = (ExtensibilityElement) bodyElems.elementAt(0);
if (bodyElem != null && bodyElem instanceof SOAPBody) {
SOAPBody soapBody = (SOAPBody) bodyElem;
List styles = soapBody.getEncodingStyles();
String encodingStyle = null;
if (styles != null) {
encodingStyle = styles.get(0).toString();
}
if (encodingStyle == null) {
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
}
operationInfo.setEncodingStyle(encodingStyle.toString());
operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
} else if (bodyElem != null && bodyElem instanceof SOAP12Body) {
SOAP12Body soapBody = (SOAP12Body) bodyElem;
String encodingStyle = null;
if (soapBody.getEncodingStyle() != null) {
encodingStyle = soapBody.getEncodingStyle().toString();
}
if (encodingStyle == null) {
encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
}
operationInfo.setEncodingStyle(encodingStyle.toString());
operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
}
Input inDef = oper.getInput();
if (inDef != null) {
Message inMsg = inDef.getMessage();
if (inMsg != null) {
operationInfo.setInputMessageName(inMsg.getQName().getLocalPart());
getParameterFromMessage(operationInfo, inMsg, 1);
operationInfo.setInmessage(inMsg);
}
}
Output outDef = oper.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
if (outMsg != null) {
operationInfo.setOutputMessageName(outMsg.getQName().getLocalPart());
getParameterFromMessage(operationInfo, outMsg, 2);
operationInfo.setOutmessage(outMsg);
}
}
return operationInfo;
}
use of javax.wsdl.BindingOperation in project tesb-studio-se by Talend.
the class PublishMetadataRunnable method process.
@SuppressWarnings("unchecked")
private void process(Definition wsdlDefinition, Collection<XmlFileConnectionItem> selectTables) throws Exception, CoreException {
File tempFile = null;
try {
File wsdlFile = null;
String baseUri = wsdlDefinition.getDocumentBaseURI();
URI uri = new URI(baseUri);
if ("file".equals(uri.getScheme())) {
wsdlFile = new File(uri.toURL().getFile());
} else {
Map<String, InputStream> load = new WSDLLoader().load(baseUri, "tempWsdl" + "%d.wsdl");
InputStream inputStream = load.get(WSDLLoader.DEFAULT_FILENAME);
tempFile = getTempFile(inputStream);
wsdlFile = tempFile;
}
if (populationUtil == null) {
populationUtil = new WSDLPopulationUtil();
populationUtil.loadWSDL("file://" + wsdlFile.getAbsolutePath());
}
final Set<QName> portTypes = new HashSet<QName>();
final Set<QName> alreadyCreated = new HashSet<QName>();
for (Binding binding : (Collection<Binding>) wsdlDefinition.getAllBindings().values()) {
final QName portType = binding.getPortType().getQName();
if (portTypes.add(portType)) {
for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
Operation oper = operation.getOperation();
Input inDef = oper.getInput();
if (inDef != null) {
Message inMsg = inDef.getMessage();
if (inMsg != null) {
// fix for TDI-20699
QName parameterFromMessage = getParameterFromMessage(inMsg);
if (parameterFromMessage == null) {
continue;
}
if (alreadyCreated.add(parameterFromMessage)) {
XsdMetadataUtils.createMetadataFromXSD(parameterFromMessage, portType.getLocalPart(), oper.getName(), selectTables, wsdlFile, populationUtil);
}
}
}
Output outDef = oper.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
if (outMsg != null) {
QName parameterFromMessage = getParameterFromMessage(outMsg);
if (parameterFromMessage == null) {
continue;
}
if (alreadyCreated.add(parameterFromMessage)) {
XsdMetadataUtils.createMetadataFromXSD(parameterFromMessage, portType.getLocalPart(), oper.getName(), selectTables, wsdlFile, populationUtil);
}
}
}
for (Fault fault : (Collection<Fault>) oper.getFaults().values()) {
Message faultMsg = fault.getMessage();
if (faultMsg != null) {
QName parameterFromMessage = getParameterFromMessage(faultMsg);
if (parameterFromMessage == null) {
continue;
}
if (alreadyCreated.add(parameterFromMessage)) {
XsdMetadataUtils.createMetadataFromXSD(parameterFromMessage, portType.getLocalPart(), oper.getName(), selectTables, wsdlFile, populationUtil);
}
}
}
}
}
}
} catch (Exception e) {
throw e;
} finally {
if (tempFile != null) {
tempFile.delete();
}
}
}
use of javax.wsdl.BindingOperation in project tesb-studio-se by Talend.
the class WSDLUtils method isOperationInBinding.
public static boolean isOperationInBinding(Definition definition, String portTypeName, String operationName) throws CoreException {
Collection<?> services = definition.getServices().values();
for (Object s : services) {
Service service = (Service) s;
Collection<?> ports = service.getPorts().values();
for (Object p : ports) {
Port port = (Port) p;
Binding binding = port.getBinding();
if (binding == null) {
continue;
}
PortType portType = binding.getPortType();
if (portType == null || !portTypeName.equals(portType.getQName().getLocalPart())) {
continue;
}
List<?> bindingOperations = binding.getBindingOperations();
for (Object o : bindingOperations) {
BindingOperation bo = (BindingOperation) o;
if (operationName.equals(bo.getName())) {
return true;
}
}
}
}
return false;
}
use of javax.wsdl.BindingOperation in project tomee by apache.
the class JaxRpcServiceInfoBuilder method buildOperations.
private Set<QName> buildOperations(Binding binding, Class serviceEndpointInterface, boolean lightweight) throws OpenEJBException {
Set<QName> wrappedElementQNames = new HashSet<QName>();
for (Object op : binding.getBindingOperations()) {
BindingOperation bindingOperation = (BindingOperation) op;
String operationName = bindingOperation.getOperation().getName();
if (lightweight) {
// Lightweight mappings are solely based on the Java method
Method method = getMethodForOperation(operationName, serviceEndpointInterface);
// Build the operation info using the method
LightweightOperationInfoBuilder operationInfoBuilder = new LightweightOperationInfoBuilder(bindingOperation, method);
JaxRpcOperationInfo operationInfo = operationInfoBuilder.buildOperationInfo();
serviceInfo.operations.add(operationInfo);
} else {
// Heavyweight mappings are solely based on the Java to XML mapping declarations
ServiceEndpointMethodMapping methodMapping = getMethodMappingForOperation(operationName, serviceEndpointInterface);
// Build the operation info using the Java to XML method mapping
HeavyweightOperationInfoBuilder operationInfoBuilder = new HeavyweightOperationInfoBuilder(bindingOperation, methodMapping, javaWsdlMapping, schemaInfo);
JaxRpcOperationInfo operationInfo = operationInfoBuilder.buildOperationInfo();
serviceInfo.operations.add(operationInfo);
// remember wrapped elements for type mapping
Set<QName> wrappedElementQNamesForOper = operationInfoBuilder.getWrapperElementQNames();
wrappedElementQNames.addAll(wrappedElementQNamesForOper);
}
}
return wrappedElementQNames;
}
use of javax.wsdl.BindingOperation in project Activiti by Activiti.
the class WSDLImporter method importServicesAndOperations.
/**
* Imports services and operations from the WSDL definition
*/
private void importServicesAndOperations(Definition definition) {
for (Object serviceObject : definition.getServices().values()) {
Service service = (Service) serviceObject;
WSService wsService = this.importService(service);
this.wsServices.put(this.namespace + wsService.getName(), wsService);
Port port = (Port) service.getPorts().values().iterator().next();
for (Object bindOperationObject : port.getBinding().getBindingOperations()) {
BindingOperation bindOperation = (BindingOperation) bindOperationObject;
WSOperation operation = this.processOperation(bindOperation.getOperation(), wsService);
wsService.addOperation(operation);
this.wsOperations.put(this.namespace + operation.getName(), operation);
}
}
}
Aggregations