Search in sources :

Example 1 with Message

use of javax.wsdl.Message in project tdi-studio-se by Talend.

the class ComponentBuilder method buildOperation.

private OperationInfo buildOperation(OperationInfo operationInfo, BindingOperation bindingOper) {
    Operation oper = bindingOper.getOperation();
    operationInfo.setTargetMethodName(oper.getName());
    Vector operElems = findExtensibilityElement(bindingOper.getExtensibilityElements(), "operation");
    ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
    if (operElem != null && operElem instanceof SOAPOperation) {
        SOAPOperation soapOperation = (SOAPOperation) operElem;
        operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
    } else if (operElem != null && operElem instanceof SOAP12Operation) {
        SOAP12Operation soapOperation = (SOAP12Operation) operElem;
        operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
    }
    BindingInput bindingInput = bindingOper.getBindingInput();
    BindingOutput bindingOutput = bindingOper.getBindingOutput();
    Vector bodyElems = findExtensibilityElement(bindingInput.getExtensibilityElements(), "body");
    ExtensibilityElement bodyElem = (ExtensibilityElement) bodyElems.elementAt(0);
    if (bodyElem != null && bodyElem instanceof SOAPBody) {
        SOAPBody soapBody = (SOAPBody) bodyElem;
        List styles = soapBody.getEncodingStyles();
        String encodingStyle = null;
        if (styles != null) {
            encodingStyle = styles.get(0).toString();
        }
        if (encodingStyle == null) {
            encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
        }
        operationInfo.setEncodingStyle(encodingStyle.toString());
        operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
    } else if (bodyElem != null && bodyElem instanceof SOAP12Body) {
        SOAP12Body soapBody = (SOAP12Body) bodyElem;
        String encodingStyle = null;
        if (soapBody.getEncodingStyle() != null) {
            encodingStyle = soapBody.getEncodingStyle().toString();
        }
        if (encodingStyle == null) {
            encodingStyle = DEFAULT_SOAP_ENCODING_STYLE;
        }
        operationInfo.setEncodingStyle(encodingStyle.toString());
        operationInfo.setTargetObjectURI(soapBody.getNamespaceURI());
    }
    Input inDef = oper.getInput();
    if (inDef != null) {
        Message inMsg = inDef.getMessage();
        if (inMsg != null) {
            operationInfo.setInputMessageName(inMsg.getQName().getLocalPart());
            getParameterFromMessage(operationInfo, inMsg, 1);
            operationInfo.setInmessage(inMsg);
        }
    }
    Output outDef = oper.getOutput();
    if (outDef != null) {
        Message outMsg = outDef.getMessage();
        if (outMsg != null) {
            operationInfo.setOutputMessageName(outMsg.getQName().getLocalPart());
            getParameterFromMessage(operationInfo, outMsg, 2);
            operationInfo.setOutmessage(outMsg);
        }
    }
    return operationInfo;
}
Also used : SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) BindingOutput(javax.wsdl.BindingOutput) SOAP12Body(javax.wsdl.extensions.soap12.SOAP12Body) Message(javax.wsdl.Message) Operation(javax.wsdl.Operation) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) BindingOperation(javax.wsdl.BindingOperation) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) BindingInput(javax.wsdl.BindingInput) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) SOAPBody(javax.wsdl.extensions.soap.SOAPBody) Input(javax.wsdl.Input) BindingInput(javax.wsdl.BindingInput) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) BindingOutput(javax.wsdl.BindingOutput) Output(javax.wsdl.Output) List(java.util.List) ArrayList(java.util.ArrayList) Vector(java.util.Vector)

Example 2 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 3 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 4 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 5 with Message

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

the class AttributeVisitor method generateGetter.

private void generateGetter(AST typeNode, AST nameNode) {
    // generate wrapped doc element in parameter
    XmlSchemaElement inParameters = generateWrappedDocElement(null, GETTER_PREFIX + nameNode.toString(), PARAM_NAME);
    // generate wrapped doc element out parameter
    XmlSchemaElement outParameters = generateWrappedDocElement(typeNode, GETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME);
    // generate input message
    Message inMsg = generateMessage(inParameters, GETTER_PREFIX + nameNode.toString());
    // generate output message
    Message outMsg = generateMessage(outParameters, GETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
    // generate operation
    String name = GETTER_PREFIX + nameNode.toString();
    Operation op = generateOperation(name, inMsg, outMsg);
    // generate corba return param
    ArgType corbaReturn = generateCorbaReturnParam(typeNode);
    // generate corba operation
    OperationType corbaOp = generateCorbaOperation(op, null, corbaReturn);
    // generate binding
    generateCorbaBindingOperation(binding, op, corbaOp);
}
Also used : ArgType(org.apache.cxf.binding.corba.wsdl.ArgType) Message(javax.wsdl.Message) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Operation(javax.wsdl.Operation) BindingOperation(javax.wsdl.BindingOperation) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType)

Aggregations

Message (javax.wsdl.Message)40 QName (javax.xml.namespace.QName)24 Part (javax.wsdl.Part)21 Operation (javax.wsdl.Operation)18 Input (javax.wsdl.Input)17 Output (javax.wsdl.Output)15 BindingOperation (javax.wsdl.BindingOperation)14 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)9 Binding (javax.wsdl.Binding)8 PortType (javax.wsdl.PortType)8 BindingInput (javax.wsdl.BindingInput)7 Fault (javax.wsdl.Fault)7 BindingOutput (javax.wsdl.BindingOutput)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 Map (java.util.Map)4 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)4 Collection (java.util.Collection)3 HashMap (java.util.HashMap)3