Search in sources :

Example 1 with WSDLBindingFactory

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;
}
Also used : BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingFault(javax.wsdl.BindingFault) QName(javax.xml.namespace.QName) WSDLBindingFactory(org.apache.cxf.wsdl.binding.WSDLBindingFactory) AbstractBindingFactory(org.apache.cxf.binding.AbstractBindingFactory) BindingOperation(javax.wsdl.BindingOperation) BindingInfo(org.apache.cxf.service.model.BindingInfo) DescriptionInfo(org.apache.cxf.service.model.DescriptionInfo) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) WSDLBindingFactory(org.apache.cxf.wsdl.binding.WSDLBindingFactory) AbstractBindingFactory(org.apache.cxf.binding.AbstractBindingFactory) BindingFactory(org.apache.cxf.binding.BindingFactory)

Aggregations

BindingFault (javax.wsdl.BindingFault)1 BindingOperation (javax.wsdl.BindingOperation)1 QName (javax.xml.namespace.QName)1 AbstractBindingFactory (org.apache.cxf.binding.AbstractBindingFactory)1 BindingFactory (org.apache.cxf.binding.BindingFactory)1 BindingFaultInfo (org.apache.cxf.service.model.BindingFaultInfo)1 BindingInfo (org.apache.cxf.service.model.BindingInfo)1 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)1 DescriptionInfo (org.apache.cxf.service.model.DescriptionInfo)1 WSDLBindingFactory (org.apache.cxf.wsdl.binding.WSDLBindingFactory)1