use of javax.wsdl.Binding in project carbon-apimgt by wso2.
the class WSDL11SOAPOperationExtractor method getSoapBindingOperations.
/**
* Retrieves all the operations defined in the provided WSDL definition.
*
* @param definition WSDL Definition
* @return a set of {@link WSDLOperation} defined in the provided WSDL definition
*/
private Set<WSDLSOAPOperation> getSoapBindingOperations(Definition definition) throws APIMgtWSDLException {
Set<WSDLSOAPOperation> allOperations = new HashSet<>();
for (Object bindingObj : definition.getAllBindings().values()) {
if (bindingObj instanceof Binding) {
Binding binding = (Binding) bindingObj;
Set<WSDLSOAPOperation> operations = getSOAPBindingOperations(binding);
allOperations.addAll(operations);
}
}
return allOperations;
}
use of javax.wsdl.Binding in project cxf by apache.
the class CorbaObjectReferenceEventProducer method getObjectReferenceBinding.
protected EprMetaData getObjectReferenceBinding(Definition wsdlDef, QName bindingName) {
EprMetaData info = new EprMetaData();
Binding wsdlBinding = wsdlDef.getBinding(bindingName);
// get the list of all bindings and compare their local parts against our name.
if (wsdlBinding == null && bindingName.getNamespaceURI().isEmpty() && !bindingName.getLocalPart().isEmpty()) {
Collection<Binding> bindingsCollection = CastUtils.cast(wsdlDef.getBindings().values());
for (Binding b : bindingsCollection) {
if (b.getQName().getLocalPart().equals(bindingName.getLocalPart())) {
wsdlBinding = b;
break;
}
}
}
if (wsdlBinding != null) {
info.setBinding(wsdlBinding);
info.setCandidateWsdlDef(wsdlDef);
}
return info;
}
use of javax.wsdl.Binding in project cxf by apache.
the class CorbaObjectReferenceHelper method getDefaultBinding.
public static Binding getDefaultBinding(Object obj, Definition wsdlDef) {
LOG.log(Level.FINEST, "Getting binding for a default object reference");
Collection<Binding> bindings = CastUtils.cast(wsdlDef.getBindings().values());
for (Binding b : bindings) {
List<?> extElements = b.getExtensibilityElements();
// Get the list of all extensibility elements
for (Iterator<?> extIter = extElements.iterator(); extIter.hasNext(); ) {
java.lang.Object element = extIter.next();
// Find a binding type so we can check against its repository ID
if (element instanceof BindingType) {
BindingType type = (BindingType) element;
if (obj._is_a(type.getRepositoryID())) {
return b;
}
}
}
}
return null;
}
use of javax.wsdl.Binding in project cxf by apache.
the class WSDLTypes method processObject.
public static CorbaType processObject(Definition definition, XmlSchemaComplexType complex, XmlSchemaAnnotation annotation, QName typeName, QName defaultName, String idlNamespace) throws Exception {
CorbaType corbaTypeImpl = null;
if (annotation != null) {
for (XmlSchemaAnnotationItem item : annotation.getItems()) {
XmlSchemaAppInfo appInfo = (XmlSchemaAppInfo) item;
if (appInfo != null) {
NodeList nlist = appInfo.getMarkup();
Node node = nlist.item(0);
String info = node.getNodeValue();
info = info.trim();
if ("corba:binding=".equals(info.substring(0, 14))) {
String bindingName = info.substring(14);
QName bqname = new QName(definition.getTargetNamespace(), bindingName);
// Check if the Binding with name already exists
Binding binding = null;
if (WSDLToCorbaHelper.queryBinding(definition, bqname)) {
binding = definition.getBinding(bqname);
}
if (binding != null) {
org.apache.cxf.binding.corba.wsdl.Object obj = new org.apache.cxf.binding.corba.wsdl.Object();
PortType portT = binding.getPortType();
QName name = new QName(idlNamespace, portT.getQName().getLocalPart(), definition.getPrefix(idlNamespace));
obj.setName(name.getLocalPart());
obj.setQName(name);
QName bName = binding.getQName();
obj.setBinding(bName);
// get the repository id of the binding.
String repId = null;
Iterator<?> bindIter = binding.getExtensibilityElements().iterator();
while (bindIter.hasNext()) {
BindingType type = (BindingType) bindIter.next();
repId = type.getRepositoryID();
}
obj.setRepositoryID(repId);
obj.setType(typeName);
corbaTypeImpl = obj;
} else {
// if (isVerboseOn()) {
System.out.println("Could not find binding for: " + bqname);
// }
}
}
}
}
}
if (corbaTypeImpl == null) {
org.apache.cxf.binding.corba.wsdl.Object obj = new org.apache.cxf.binding.corba.wsdl.Object();
QName name = new QName(idlNamespace, "CORBA.Object", definition.getPrefix(idlNamespace));
obj.setName(name.getLocalPart());
obj.setQName(name);
obj.setRepositoryID("IDL:omg.org/CORBA/Object/1.0");
obj.setType(typeName);
corbaTypeImpl = obj;
}
return corbaTypeImpl;
}
use of javax.wsdl.Binding in project cxf by apache.
the class WSDLToCorbaBindingTest method testFixedBindingGeneration.
@Test
public void testFixedBindingGeneration() throws Exception {
String fileName = getClass().getResource("/wsdl/fixed.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("Y");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertEquals(1, typemap.getElementsByTagName("corba:sequence").getLength());
assertEquals(5, typemap.getElementsByTagName("corba:fixed").getLength());
Element bindingElement = getElementNode(document, "binding");
assertEquals(5, bindingElement.getElementsByTagName("corba:operation").getLength());
QName bName = new QName("http://schemas.apache.org/idl/fixed.idl", "YCORBABinding", "tns");
Binding binding = model.getBinding(bName);
TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
Map<String, CorbaType> tmap = new HashMap<>();
for (CorbaType type : mapType.getStructOrExceptionOrUnion()) {
tmap.put(type.getName(), type);
}
Iterator<?> j = binding.getBindingOperations().iterator();
while (j.hasNext()) {
BindingOperation bindingOperation = (BindingOperation) j.next();
assertEquals("YCORBABinding", binding.getQName().getLocalPart());
assertEquals(1, bindingOperation.getExtensibilityElements().size());
checkFixedTypeOne(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkSequenceType(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeTwo(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeThree(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeFour(bindingOperation, tmap);
}
}
Aggregations