Search in sources :

Example 11 with BindingFault

use of javax.wsdl.BindingFault in project cxf by apache.

the class AbstractWSDLBindingFactory method initializeBindingInfo.

protected BindingInfo initializeBindingInfo(ServiceInfo service, Binding binding, BindingInfo bi) {
    bi.setName(binding.getQName());
    copyExtensors(bi, binding, null);
    for (BindingOperation bop : cast(binding.getBindingOperations(), BindingOperation.class)) {
        String inName = null;
        String outName = null;
        if (bop.getBindingInput() != null) {
            inName = bop.getBindingInput().getName();
        }
        if (bop.getBindingOutput() != null) {
            outName = bop.getBindingOutput().getName();
        }
        String portTypeNs = binding.getPortType().getQName().getNamespaceURI();
        QName opName = new QName(portTypeNs, bop.getName());
        BindingOperationInfo bop2 = bi.getOperation(opName);
        if (bop2 == null) {
            bop2 = bi.buildOperation(opName, inName, outName);
            if (bop2 != null) {
                bi.addOperation(bop2);
            }
        }
        if (bop2 != null) {
            copyExtensors(bop2, bop, bop2);
            if (bop.getBindingInput() != null) {
                copyExtensors(bop2.getInput(), bop.getBindingInput(), bop2);
            }
            if (bop.getBindingOutput() != null) {
                copyExtensors(bop2.getOutput(), bop.getBindingOutput(), bop2);
            }
            for (BindingFault f : cast(bop.getBindingFaults().values(), BindingFault.class)) {
                if (StringUtils.isEmpty(f.getName())) {
                    throw new IllegalArgumentException("wsdl:fault and soap:fault elements" + " must have a name attribute.");
                }
                copyExtensors(bop2.getFault(new QName(service.getTargetNamespace(), f.getName())), bop.getBindingFault(f.getName()), bop2);
            }
        }
    }
    return bi;
}
Also used : BindingOperation(javax.wsdl.BindingOperation) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingFault(javax.wsdl.BindingFault) QName(javax.xml.namespace.QName)

Aggregations

BindingFault (javax.wsdl.BindingFault)11 BindingOperation (javax.wsdl.BindingOperation)7 QName (javax.xml.namespace.QName)6 Fault (javax.wsdl.Fault)5 Binding (javax.wsdl.Binding)4 BindingInput (javax.wsdl.BindingInput)3 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)3 ToolException (org.apache.cxf.tools.common.ToolException)3 Test (org.junit.Test)3 File (java.io.File)2 BindingOutput (javax.wsdl.BindingOutput)2 Definition (javax.wsdl.Definition)2 Message (javax.wsdl.Message)2 Operation (javax.wsdl.Operation)2 SOAP12Binding (javax.wsdl.extensions.soap12.SOAP12Binding)2 SoapBinding (org.apache.cxf.binding.soap.wsdl.extensions.SoapBinding)2 SoapFault (org.apache.cxf.binding.soap.wsdl.extensions.SoapFault)2 SoapOperation (org.apache.cxf.binding.soap.wsdl.extensions.SoapOperation)2 BindingFaultInfo (org.apache.cxf.service.model.BindingFaultInfo)2 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)2