Search in sources :

Example 11 with Message

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

the class WSDLParameter method processWrappedOutputParams.

private void processWrappedOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
    Output output = operation.getOutput();
    if (output != null) {
        Message msg = output.getMessage();
        Part part = (Part) msg.getOrderedParts(null).iterator().next();
        XmlSchemaComplexType schemaType = null;
        XmlSchemaElement el = getElement(part, xmlSchemaList);
        if (el == null) {
            return;
        }
        if (el.getSchemaType() != null) {
            schemaType = (XmlSchemaComplexType) el.getSchemaType();
        }
        XmlSchemaSequence seq = (XmlSchemaSequence) schemaType.getParticle();
        if (seq != null) {
            for (XmlSchemaSequenceMember seqMember : seq.getItems()) {
                if (seqMember instanceof XmlSchemaElement) {
                    el = (XmlSchemaElement) seqMember;
                    processWrappedOutputParam(wsdlToCorbaBinding, el, inputs, outputs);
                }
            }
        }
    }
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) Message(javax.wsdl.Message) Part(javax.wsdl.Part) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Output(javax.wsdl.Output) XmlSchemaSequenceMember(org.apache.ws.commons.schema.XmlSchemaSequenceMember) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Example 12 with Message

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

the class WSDLParameter method processInputParams.

private void processInputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs) throws Exception {
    Input input = operation.getInput();
    if (input != null) {
        Message msg = input.getMessage();
        List<Part> parts = CastUtils.cast(msg.getOrderedParts(null));
        for (Part part : parts) {
            XmlSchemaType schemaType = null;
            boolean isObjectRef = isObjectReference(xmlSchemaList, part.getElementName());
            if (part.getElementName() != null && !isObjectRef) {
                XmlSchemaElement el = getElement(part, xmlSchemaList);
                if (el != null) {
                    if (el.getSchemaType() != null) {
                        schemaType = el.getSchemaType();
                    }
                    QName typeName = el.getSchemaTypeName();
                    if (typeName == null) {
                        typeName = el.getQName();
                    }
                    QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
                    ParamType paramtype = createParam(wsdlToCorbaBinding, "in", part.getName(), idltype);
                    if (paramtype != null) {
                        inputs.add(paramtype);
                    }
                }
            } else if (part.getTypeName() != null) {
                schemaType = getType(part, xmlSchemaList);
                QName typeName = part.getTypeName();
                if (isObjectRef) {
                    typeName = part.getElementName();
                }
                QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
                ParamType paramtype = createParam(wsdlToCorbaBinding, "in", part.getName(), idltype);
                if (paramtype != null) {
                    inputs.add(paramtype);
                }
            }
        }
    }
}
Also used : Input(javax.wsdl.Input) Message(javax.wsdl.Message) Part(javax.wsdl.Part) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType)

Example 13 with Message

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

the class WSDLParameter method processOutputParams.

private void processOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
    Output output = operation.getOutput();
    if (output != null) {
        Message msg = output.getMessage();
        List<Part> parts = CastUtils.cast(msg.getOrderedParts(null));
        for (Part part : parts) {
            XmlSchemaType schemaType = null;
            // check if in input list
            String mode = "out";
            ParamType paramtype = null;
            boolean isObjectRef = isObjectReference(xmlSchemaList, part.getElementName());
            for (int x = 0; x < inputs.size(); x++) {
                paramtype = null;
                ParamType d2 = inputs.get(x);
                if (part.getElementName() != null && !isObjectRef) {
                    XmlSchemaElement el = getElement(part, xmlSchemaList);
                    if (el != null) {
                        if (el.getSchemaType() != null) {
                            schemaType = el.getSchemaType();
                        }
                        QName typeName = el.getSchemaTypeName();
                        if (typeName == null) {
                            typeName = el.getQName();
                        }
                        QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
                        if ((d2.getName().equals(part.getName())) && (d2.getIdltype().equals(idltype))) {
                            inputs.remove(x);
                            paramtype = createParam(wsdlToCorbaBinding, "inout", part.getName(), idltype);
                            inputs.add(paramtype);
                        }
                    }
                } else {
                    schemaType = getType(part, xmlSchemaList);
                    QName typeName = part.getTypeName();
                    if (isObjectRef) {
                        typeName = part.getElementName();
                    }
                    QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
                    if ((d2.getName().equals(part.getName())) && (d2.getIdltype().equals(idltype))) {
                        inputs.remove(x);
                        paramtype = createParam(wsdlToCorbaBinding, "inout", part.getName(), idltype);
                        inputs.add(paramtype);
                    }
                }
            }
            if (paramtype == null) {
                if (part.getElementName() != null && !isObjectRef) {
                    XmlSchemaElement el = getElement(part, xmlSchemaList);
                    QName typeName = el.getSchemaTypeName();
                    if (typeName == null) {
                        typeName = el.getQName();
                    }
                    QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, el.isNillable());
                    paramtype = createParam(wsdlToCorbaBinding, mode, part.getName(), idltype);
                } else {
                    QName typeName = part.getTypeName();
                    if (isObjectRef) {
                        typeName = part.getElementName();
                    }
                    QName idltype = getIdlType(wsdlToCorbaBinding, schemaType, typeName, false);
                    paramtype = createParam(wsdlToCorbaBinding, mode, part.getName(), idltype);
                }
                if (paramtype != null) {
                    outputs.add(paramtype);
                }
            }
        }
    }
}
Also used : Message(javax.wsdl.Message) Part(javax.wsdl.Part) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) QName(javax.xml.namespace.QName) Output(javax.wsdl.Output) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType)

Example 14 with Message

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

the class OperationVisitor method generateOutputMessage.

public Message generateOutputMessage(Operation operation, BindingOperation bindingOperation) {
    Message msg = definition.createMessage();
    QName msgName;
    if (!mapper.isDefaultMapping()) {
        // mangle the message name
        // REVISIT, do we put in the entire scope for mangling
        msgName = new QName(definition.getTargetNamespace(), getScope().tail() + "." + operation.getName() + RESPONSE_SUFFIX);
    } else {
        msgName = new QName(definition.getTargetNamespace(), operation.getName() + RESPONSE_SUFFIX);
    }
    msg.setQName(msgName);
    msg.setUndefined(false);
    String outputName = operation.getName() + RESPONSE_SUFFIX;
    Output output = definition.createOutput();
    output.setName(outputName);
    output.setMessage(msg);
    BindingOutput bindingOutput = definition.createBindingOutput();
    bindingOutput.setName(outputName);
    bindingOperation.setBindingOutput(bindingOutput);
    operation.setOutput(output);
    definition.addMessage(msg);
    return msg;
}
Also used : BindingOutput(javax.wsdl.BindingOutput) Message(javax.wsdl.Message) QName(javax.xml.namespace.QName) BindingOutput(javax.wsdl.BindingOutput) Output(javax.wsdl.Output)

Example 15 with Message

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

the class OperationVisitor method createFaultMessage.

private void createFaultMessage(CorbaTypeImpl corbaType, Operation operation, BindingOperation bindingOperation, QName elementQName) {
    String exceptionName = corbaType.getQName().getLocalPart();
    Definition faultDef = manager.getWSDLDefinition(elementQName.getNamespaceURI());
    if (faultDef == null) {
        faultDef = definition;
    }
    Message faultMsg = faultDef.getMessage(new QName(faultDef.getTargetNamespace(), exceptionName));
    if (faultMsg == null) {
        throw new RuntimeException("Fault message for exception " + exceptionName + " not found");
    }
    // porttype - operation - fault
    Fault fault = definition.createFault();
    fault.setMessage(faultMsg);
    fault.setName(faultMsg.getQName().getLocalPart());
    operation.addFault(fault);
    // binding - operation - corba:operation - corba:raises
    RaisesType raisesType = new RaisesType();
    raisesType.setException(new QName(typeMap.getTargetNamespace(), exceptionName));
    corbaOperation.getRaises().add(raisesType);
    // binding - operation - fault
    BindingFault bindingFault = definition.createBindingFault();
    bindingFault.setName(faultMsg.getQName().getLocalPart());
    bindingOperation.addBindingFault(bindingFault);
    // add the fault element namespace to the definition
    String nsURI = elementQName.getNamespaceURI();
    manager.addWSDLDefinitionNamespace(definition, mapper.mapNSToPrefix(nsURI), nsURI);
}
Also used : RaisesType(org.apache.cxf.binding.corba.wsdl.RaisesType) Message(javax.wsdl.Message) BindingFault(javax.wsdl.BindingFault) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) BindingFault(javax.wsdl.BindingFault) Fault(javax.wsdl.Fault)

Aggregations

Message (javax.wsdl.Message)45 Part (javax.wsdl.Part)26 QName (javax.xml.namespace.QName)25 Operation (javax.wsdl.Operation)22 Input (javax.wsdl.Input)20 BindingOperation (javax.wsdl.BindingOperation)18 Output (javax.wsdl.Output)16 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)9 Map (java.util.Map)8 Binding (javax.wsdl.Binding)8 PortType (javax.wsdl.PortType)8 HashMap (java.util.HashMap)7 BindingInput (javax.wsdl.BindingInput)7 Fault (javax.wsdl.Fault)7 SOAPOperation (javax.wsdl.extensions.soap.SOAPOperation)7 ArrayList (java.util.ArrayList)6 SOAP12Operation (javax.wsdl.extensions.soap12.SOAP12Operation)6 BindingOutput (javax.wsdl.BindingOutput)5 Test (org.junit.Test)5 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)4