Search in sources :

Example 16 with Fault

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

the class PartialWSDLProcessor method addSoapFaults.

private static void addSoapFaults(Operation op, BindingOperation bindingOperation, Definition wsdlDefinition, ExtensionRegistry extReg) throws Exception {
    Map<String, Fault> faults = CastUtils.cast(op.getFaults());
    for (Fault fault : faults.values()) {
        BindingFault bf = wsdlDefinition.createBindingFault();
        bf.setName(fault.getName());
        setSoapFaultExtElement(bf, extReg);
        bindingOperation.addBindingFault(bf);
    }
}
Also used : BindingFault(javax.wsdl.BindingFault) BindingFault(javax.wsdl.BindingFault) Fault(javax.wsdl.Fault) SOAPFault(javax.wsdl.extensions.soap.SOAPFault)

Example 17 with Fault

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

the class ServiceWSDLBuilder method buildPortTypeOperation.

protected void buildPortTypeOperation(PortType portType, Collection<OperationInfo> operationInfos, final Definition def) {
    for (OperationInfo operationInfo : operationInfos) {
        Operation operation = null;
        try {
            operation = operationInfo.getProperty(WSDLServiceBuilder.WSDL_OPERATION, Operation.class);
        } catch (ClassCastException e) {
        // do nothing
        }
        if (operation == null) {
            operation = def.createOperation();
            addDocumentation(operation, operationInfo.getDocumentation());
            operation.setUndefined(false);
            operation.setName(operationInfo.getName().getLocalPart());
            addNamespace(operationInfo.getName().getNamespaceURI(), def);
            if (operationInfo.isOneWay()) {
                operation.setStyle(OperationType.ONE_WAY);
            }
            addExtensibilityElements(def, operation, getWSDL11Extensors(operationInfo));
            Input input = def.createInput();
            addDocumentation(input, operationInfo.getInput().getDocumentation());
            input.setName(operationInfo.getInputName());
            Message message = def.createMessage();
            buildMessage(message, operationInfo.getInput(), def);
            this.addExtensibilityAttributes(def, input, getInputExtensionAttributes(operationInfo));
            this.addExtensibilityElements(def, input, getWSDL11Extensors(operationInfo.getInput()));
            input.setMessage(message);
            operation.setInput(input);
            operation.setParameterOrdering(operationInfo.getParameterOrdering());
            if (operationInfo.getOutput() != null) {
                Output output = def.createOutput();
                addDocumentation(output, operationInfo.getOutput().getDocumentation());
                output.setName(operationInfo.getOutputName());
                message = def.createMessage();
                buildMessage(message, operationInfo.getOutput(), def);
                this.addExtensibilityAttributes(def, output, getOutputExtensionAttributes(operationInfo));
                this.addExtensibilityElements(def, output, getWSDL11Extensors(operationInfo.getOutput()));
                output.setMessage(message);
                operation.setOutput(output);
            }
            // loop to add fault
            Collection<FaultInfo> faults = operationInfo.getFaults();
            for (FaultInfo faultInfo : faults) {
                final Fault fault = def.createFault();
                addDocumentation(fault, faultInfo.getDocumentation());
                fault.setName(faultInfo.getFaultName().getLocalPart());
                message = def.createMessage();
                buildMessage(message, faultInfo, def);
                this.addExtensibilityAttributes(def, fault, faultInfo.getExtensionAttributes());
                this.addExtensibilityElements(def, fault, getWSDL11Extensors(faultInfo));
                fault.setMessage(message);
                operation.addFault(fault);
            }
        }
        portType.addOperation(operation);
    }
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) Input(javax.wsdl.Input) BindingInput(javax.wsdl.BindingInput) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) FaultInfo(org.apache.cxf.service.model.FaultInfo) Message(javax.wsdl.Message) BindingOutput(javax.wsdl.BindingOutput) Output(javax.wsdl.Output) Fault(javax.wsdl.Fault) BindingFault(javax.wsdl.BindingFault) Operation(javax.wsdl.Operation) BindingOperation(javax.wsdl.BindingOperation)

Example 18 with Fault

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

the class WSDLServiceBuilder method buildInterfaceOperation.

private void buildInterfaceOperation(InterfaceInfo inf, Operation op) {
    OperationInfo opInfo = inf.addOperation(new QName(inf.getName().getNamespaceURI(), op.getName()));
    if (recordOriginal) {
        opInfo.setProperty(WSDL_OPERATION, op);
    }
    copyDocumentation(opInfo, op);
    List<String> porderList = CastUtils.cast((List<?>) op.getParameterOrdering());
    opInfo.setParameterOrdering(porderList);
    this.copyExtensors(opInfo, op.getExtensibilityElements());
    this.copyExtensionAttributes(opInfo, op);
    Input input = op.getInput();
    if (input != null) {
        if (input.getMessage() == null) {
            throw new WSDLRuntimeException(LOG, "NO_MESSAGE", "input", op.getName(), input.getName());
        }
        MessageInfo minfo = opInfo.createMessage(input.getMessage().getQName(), MessageInfo.Type.INPUT);
        opInfo.setInput(input.getName(), minfo);
        buildMessage(minfo, input.getMessage());
        copyExtensors(minfo, input.getExtensibilityElements());
        copyExtensionAttributes(minfo, input);
    }
    Output output = op.getOutput();
    if (output != null) {
        if (output.getMessage() == null) {
            throw new WSDLRuntimeException(LOG, "NO_MESSAGE", "output", op.getName(), output.getName());
        }
        MessageInfo minfo = opInfo.createMessage(output.getMessage().getQName(), MessageInfo.Type.OUTPUT);
        opInfo.setOutput(output.getName(), minfo);
        buildMessage(minfo, output.getMessage());
        copyExtensors(minfo, output.getExtensibilityElements());
        copyExtensionAttributes(minfo, output);
    }
    Map<?, ?> m = op.getFaults();
    for (Map.Entry<?, ?> rawentry : m.entrySet()) {
        Map.Entry<String, Fault> entry = cast(rawentry, String.class, Fault.class);
        FaultInfo finfo = opInfo.addFault(new QName(inf.getName().getNamespaceURI(), entry.getKey()), entry.getValue().getMessage().getQName());
        copyDocumentation(finfo, entry.getValue());
        buildMessage(finfo, entry.getValue().getMessage());
        copyExtensors(finfo, entry.getValue().getExtensibilityElements());
        copyExtensionAttributes(finfo, entry.getValue());
    }
    checkForWrapped(opInfo, allowRefs, false, unwrapLogLevel);
}
Also used : OperationInfo(org.apache.cxf.service.model.OperationInfo) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) UnwrappedOperationInfo(org.apache.cxf.service.model.UnwrappedOperationInfo) BindingFaultInfo(org.apache.cxf.service.model.BindingFaultInfo) FaultInfo(org.apache.cxf.service.model.FaultInfo) QName(javax.xml.namespace.QName) Fault(javax.wsdl.Fault) BindingFault(javax.wsdl.BindingFault) MessageInfo(org.apache.cxf.service.model.MessageInfo) BindingMessageInfo(org.apache.cxf.service.model.BindingMessageInfo) Input(javax.wsdl.Input) Output(javax.wsdl.Output) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

Fault (javax.wsdl.Fault)18 Operation (javax.wsdl.Operation)10 BindingOperation (javax.wsdl.BindingOperation)9 QName (javax.xml.namespace.QName)9 BindingFault (javax.wsdl.BindingFault)8 Message (javax.wsdl.Message)7 Input (javax.wsdl.Input)6 Output (javax.wsdl.Output)6 Binding (javax.wsdl.Binding)5 Part (javax.wsdl.Part)5 PortType (javax.wsdl.PortType)4 ArrayList (java.util.ArrayList)3 Collection (java.util.Collection)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 BindingInput (javax.wsdl.BindingInput)3 BindingOutput (javax.wsdl.BindingOutput)3 SOAPFault (org.apache.axiom.soap.SOAPFault)3 AxisFault (org.apache.axis2.AxisFault)3 Definition (javax.wsdl.Definition)2