use of javax.wsdl.BindingOperation in project tesb-studio-se by Talend.
the class ComponentBuilder method populateComponent.
private static ServiceInfo populateComponent(Service service) {
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setServiceName(service.getQName());
Collection<Port> ports = service.getPorts().values();
for (Port port : ports) {
String soapLocation = null;
SOAPAddress soapAddress = findExtensibilityElement(port.getExtensibilityElements(), SOAPAddress.class);
if (null != soapAddress) {
soapLocation = soapAddress.getLocationURI();
} else {
SOAP12Address soap12Address = findExtensibilityElement(port.getExtensibilityElements(), SOAP12Address.class);
if (null != soap12Address) {
soapLocation = soap12Address.getLocationURI();
}
}
Binding binding = port.getBinding();
for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
SOAPOperation soapOperation = findExtensibilityElement(operation.getExtensibilityElements(), SOAPOperation.class);
if (null != soapOperation && OPERATION_TYPE_RPC.equalsIgnoreCase(soapOperation.getStyle())) {
// TESB-6151 disable display of unsupported RPC type.
serviceInfo.setHasRpcOperation(true);
continue;
}
OperationInfo operationInfo = new OperationInfo(operation.getOperation());
operationInfo.setPortName(port.getName());
operationInfo.setNamespaceURI(binding.getPortType().getQName().getNamespaceURI());
if (soapOperation != null) {
operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
} else {
SOAP12Operation soap12Operation = findExtensibilityElement(operation.getExtensibilityElements(), SOAP12Operation.class);
if (soap12Operation != null) {
operationInfo.setSoapActionURI(soap12Operation.getSoapActionURI());
}
}
operationInfo.setTargetURL(soapLocation);
serviceInfo.addOperation(operationInfo);
}
}
return serviceInfo;
}
use of javax.wsdl.BindingOperation in project tesb-studio-se by Talend.
the class PublishMetadataRunnable method getAllPaths.
@SuppressWarnings("unchecked")
private Collection<String> getAllPaths() throws URISyntaxException {
final Set<String> paths = new HashSet<String>();
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();
addParamsToPath(portType, oper, inMsg, paths, alreadyCreated);
}
Output outDef = oper.getOutput();
if (outDef != null) {
Message outMsg = outDef.getMessage();
addParamsToPath(portType, oper, outMsg, paths, alreadyCreated);
}
for (Fault fault : (Collection<Fault>) oper.getFaults().values()) {
Message faultMsg = fault.getMessage();
addParamsToPath(portType, oper, faultMsg, paths, alreadyCreated);
}
}
}
}
return paths;
}
use of javax.wsdl.BindingOperation in project tesb-studio-se by Talend.
the class WSDLUtils method getServiceOperationParameters.
public static Map<String, String> getServiceOperationParameters(IFile wsdlURI, String operationName, String portTypeName) throws CoreException {
// NOTE: all below in assuming standalone (no another WSDL's imports) WS-I complaint WSDL !
Map<String, String> map = new HashMap<String, String>();
if (null == wsdlURI) {
// no WSDL provided
return map;
}
Definition wsdl = getDefinition(wsdlURI);
for (Object serviceObject : wsdl.getServices().values()) {
Service service = (Service) serviceObject;
for (Object portObject : service.getPorts().values()) {
Port port = (Port) portObject;
try {
port.getBinding().getPortType().getQName().getLocalPart();
} catch (NullPointerException npe) {
throw getCoreException("WSDL is not consistent. Can not find portType operation description for current service.", npe);
}
if (portTypeName.equals(port.getBinding().getPortType().getQName().getLocalPart())) {
final String targetNs = wsdl.getTargetNamespace();
map.put(SERVICE_NAME, service.getQName().getLocalPart());
map.put(SERVICE_NS, targetNs);
map.put(PORT_NAME, port.getName());
map.put(PORT_NS, targetNs);
map.put(OPERATION_NAME, operationName);
map.put(WSDL_LOCATION, wsdlURI.getLocation().toPortableString());
BindingOperation bindingOperation = port.getBinding().getBindingOperation(operationName, null, null);
if (null == bindingOperation) {
throw getCoreException("Operation '" + operationName + "' not found in binding", null);
}
map.put(COMMUNICATION_STYLE, null == bindingOperation.getBindingOutput() && bindingOperation.getBindingFaults().isEmpty() ? ONE_WAY : REQUEST_RESPONSE);
String faults = null;
for (Object fault : bindingOperation.getBindingFaults().keySet()) {
if (faults == null) {
faults = (String) fault;
} else {
faults += ',' + (String) fault;
}
}
map.put(FAULTS, faults);
// map.put(OPERATION_NS, targetNs);
map.put(ENDPOINT_URI, getPortAddress(port));
break;
}
}
}
return map;
}
use of javax.wsdl.BindingOperation in project tdi-studio-se by Talend.
the class ComponentBuilder method buildOperations.
private List buildOperations(Binding binding) {
List operationInfos = new ArrayList();
List operations = binding.getBindingOperations();
if (operations != null && !operations.isEmpty()) {
Vector soapBindingElems = findExtensibilityElement(binding.getExtensibilityElements(), "binding");
// default
String style = "document";
ExtensibilityElement soapBindingElem = (ExtensibilityElement) soapBindingElems.elementAt(0);
if (soapBindingElem != null && soapBindingElem instanceof SOAPBinding) {
SOAPBinding soapBinding = (SOAPBinding) soapBindingElem;
style = soapBinding.getStyle();
} else if (soapBindingElem != null && soapBindingElem instanceof SOAP12Binding) {
SOAP12Binding soapBinding = (SOAP12Binding) soapBindingElem;
style = soapBinding.getStyle();
}
Iterator opIter = operations.iterator();
while (opIter.hasNext()) {
alldExtendtion.clear();
BindingOperation oper = (BindingOperation) opIter.next();
Vector operElems = findExtensibilityElement(oper.getExtensibilityElements(), "operation");
ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
if (operElem != null && operElem instanceof SOAPOperation) {
OperationInfo operationInfo = new OperationInfo(style);
buildOperation(operationInfo, oper);
operationInfos.add(operationInfo);
} else if (operElem != null && operElem instanceof SOAP12Operation) {
OperationInfo operationInfo = new OperationInfo(style);
buildOperation(operationInfo, oper);
operationInfos.add(operationInfo);
}
}
}
return operationInfos;
}
use of javax.wsdl.BindingOperation in project tomee by apache.
the class JaxRpcServiceInfoBuilder method getStyle.
private BindingStyle getStyle(Binding binding) throws OpenEJBException {
SOAPBinding soapBinding = getExtensibilityElement(SOAPBinding.class, binding.getExtensibilityElements());
String styleString = soapBinding.getStyle();
BindingInput bindingInput = ((BindingOperation) binding.getBindingOperations().get(0)).getBindingInput();
SOAPBody soapBody = getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
String useString = soapBody.getUse();
BindingStyle bindingStyle = BindingStyle.getBindingStyle(styleString, useString);
return bindingStyle;
}
Aggregations