use of org.apache.cxf.wsdl.binding.WSDLBindingFactory in project cxf by apache.
the class WSDLServiceBuilder method buildBinding.
public BindingInfo buildBinding(ServiceInfo service, Binding binding) {
BindingInfo bi = null;
StringBuilder ns = new StringBuilder(100);
BindingFactory factory = WSDLServiceUtils.getBindingFactory(binding, bus, ns);
if (factory instanceof WSDLBindingFactory) {
WSDLBindingFactory wFactory = (WSDLBindingFactory) factory;
bi = wFactory.createBindingInfo(service, binding, ns.toString());
copyExtensors(bi, binding.getExtensibilityElements());
copyExtensionAttributes(bi, binding);
}
if (bi == null) {
boolean onlyExtensors = false;
if (factory instanceof AbstractBindingFactory) {
bi = ((AbstractBindingFactory) factory).createBindingInfo(service, ns.toString(), null);
onlyExtensors = true;
} else {
bi = new BindingInfo(service, ns.toString());
}
bi.setName(binding.getQName());
copyExtensors(bi, binding.getExtensibilityElements());
copyExtensionAttributes(bi, binding);
for (BindingOperation bop : cast(binding.getBindingOperations(), BindingOperation.class)) {
if (LOG.isLoggable(Level.FINER)) {
LOG.finer("binding operation name is " + bop.getName());
}
String inName = null;
String outName = null;
if (bop.getBindingInput() != null) {
inName = bop.getBindingInput().getName();
}
if (bop.getBindingOutput() != null) {
outName = bop.getBindingOutput().getName();
}
final BindingOperationInfo bop2;
if (onlyExtensors) {
bop2 = bi.getOperation(new QName(binding.getQName().getNamespaceURI(), bop.getName()));
} else {
bop2 = bi.buildOperation(new QName(binding.getQName().getNamespaceURI(), bop.getName()), inName, outName);
if (bop2 != null) {
bi.addOperation(bop2);
}
}
if (bop2 != null) {
copyExtensors(bop2, bop.getExtensibilityElements());
copyExtensionAttributes(bop2, bop);
if (bop.getBindingInput() != null) {
copyExtensors(bop2.getInput(), bop.getBindingInput().getExtensibilityElements());
copyExtensionAttributes(bop2.getInput(), bop.getBindingInput());
handleHeader(bop2.getInput());
}
if (bop.getBindingOutput() != null) {
copyExtensors(bop2.getOutput(), bop.getBindingOutput().getExtensibilityElements());
copyExtensionAttributes(bop2.getOutput(), bop.getBindingOutput());
handleHeader(bop2.getOutput());
}
for (BindingFault f : cast(bop.getBindingFaults().values(), BindingFault.class)) {
BindingFaultInfo bif = bop2.getFault(new QName(service.getTargetNamespace(), f.getName()));
copyExtensors(bif, bop.getBindingFault(f.getName()).getExtensibilityElements());
copyExtensionAttributes(bif, bop.getBindingFault(f.getName()));
}
}
}
}
service.addBinding(bi);
DescriptionInfo d = service.getDescription();
if (null != d) {
d.getDescribed().add(bi);
}
return bi;
}
Aggregations