Search in sources :

Example 16 with Message

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

the class WSIBPValidator method checkR2203And2204.

public boolean checkR2203And2204() {
    Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
    for (Binding binding : bindings) {
        String style = SOAPBindingUtil.getCanonicalBindingStyle(binding);
        if (binding.getPortType() == null) {
            return true;
        }
        for (Iterator<?> ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext(); ) {
            Operation operation = (Operation) ite2.next();
            BindingOperation bop = wsdlHelper.getBindingOperation(def, operation.getName());
            if (operation.getInput() != null && operation.getInput().getMessage() != null) {
                Message inMess = operation.getInput().getMessage();
                Set<String> ignorableParts = getIgnorableParts(bop.getBindingInput());
                for (Iterator<?> ite3 = inMess.getParts().values().iterator(); ite3.hasNext(); ) {
                    Part p = (Part) ite3.next();
                    if (SOAPBinding.Style.RPC.name().equalsIgnoreCase(style) && p.getTypeName() == null && !isHeaderPart(bop, p) && !isIgnorablePart(p.getName(), ignorableParts)) {
                        addErrorMessage("An rpc-literal binding in a DESCRIPTION MUST refer, " + "in its soapbind:body element(s), only to " + "wsdl:part element(s) that have been defined " + "using the type attribute.");
                        return false;
                    }
                    if (SOAPBinding.Style.DOCUMENT.name().equalsIgnoreCase(style) && p.getElementName() == null && !isIgnorablePart(p.getName(), ignorableParts)) {
                        addErrorMessage("A document-literal binding in a DESCRIPTION MUST refer, " + "in each of its soapbind:body element(s)," + "only to wsdl:part element(s)" + " that have been defined using the element attribute.");
                        return false;
                    }
                }
            }
            if (operation.getOutput() != null && operation.getOutput().getMessage() != null) {
                Message outMess = operation.getOutput().getMessage();
                Set<String> ignorableParts = getIgnorableParts(bop.getBindingOutput());
                for (Iterator<?> ite3 = outMess.getParts().values().iterator(); ite3.hasNext(); ) {
                    Part p = (Part) ite3.next();
                    if (style.equalsIgnoreCase(SOAPBinding.Style.RPC.name()) && p.getTypeName() == null && !isHeaderPart(bop, p) && !isIgnorablePart(p.getName(), ignorableParts)) {
                        addErrorMessage("An rpc-literal binding in a DESCRIPTION MUST refer, " + "in its soapbind:body element(s), only to " + "wsdl:part element(s) that have been defined " + "using the type attribute.");
                        return false;
                    }
                    if (style.equalsIgnoreCase(SOAPBinding.Style.DOCUMENT.name()) && p.getElementName() == null && !isIgnorablePart(p.getName(), ignorableParts)) {
                        addErrorMessage("A document-literal binding in a DESCRIPTION MUST refer, " + "in each of its soapbind:body element(s)," + "only to wsdl:part element(s)" + " that have been defined using the element attribute.");
                        return false;
                    }
                }
            }
        }
    }
    return true;
}
Also used : SOAPBinding(javax.jws.soap.SOAPBinding) Binding(javax.wsdl.Binding) BindingOperation(javax.wsdl.BindingOperation) Message(javax.wsdl.Message) Part(javax.wsdl.Part) MIMEPart(javax.wsdl.extensions.mime.MIMEPart) Operation(javax.wsdl.Operation) BindingOperation(javax.wsdl.BindingOperation)

Example 17 with Message

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

the class AttributeVisitor method generateMessage.

private Message generateMessage(XmlSchemaElement element, String name) {
    Part part = definition.createPart();
    part.setName(PART_NAME);
    part.setElementName(element.getQName());
    Message result = definition.createMessage();
    QName qName = new QName(definition.getTargetNamespace(), name);
    if (definition.getMessage(qName) != null) {
        String newName = getScope().toString() + "." + name;
        qName = new QName(definition.getTargetNamespace(), newName);
    }
    result.setQName(qName);
    result.addPart(part);
    result.setUndefined(false);
    definition.addMessage(result);
    return result;
}
Also used : Message(javax.wsdl.Message) Part(javax.wsdl.Part) QName(javax.xml.namespace.QName)

Example 18 with Message

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

the class AttributeVisitor method generateSetter.

private void generateSetter(AST typeNode, AST nameNode) {
    // generate wrapped doc element in parameter
    XmlSchemaElement inParameters = generateWrappedDocElement(typeNode, SETTER_PREFIX + nameNode.toString(), PARAM_NAME);
    // generate wrapped doc element out parameter
    XmlSchemaElement outParameters = generateWrappedDocElement(null, SETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME);
    // generate input message
    Message inMsg = generateMessage(inParameters, SETTER_PREFIX + nameNode.toString());
    // generate output message
    Message outMsg = generateMessage(outParameters, SETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
    // generate operation
    String name = SETTER_PREFIX + nameNode.toString();
    Operation op = generateOperation(name, inMsg, outMsg);
    // generate corba return param
    ParamType corbaParam = generateCorbaParam(typeNode);
    // generate corba operation
    OperationType corbaOp = generateCorbaOperation(op, corbaParam, null);
    // generate binding
    generateCorbaBindingOperation(binding, op, corbaOp);
}
Also used : 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) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType)

Example 19 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)

Example 20 with Message

use of javax.wsdl.Message in project pentaho-kettle by pentaho.

the class WsdlOperation method loadParameters.

/**
 * Create the parameter list for this operations parameter set.
 *
 * @param op
 *          Operation.
 * @throws KettleStepException
 */
@SuppressWarnings("unchecked")
private void loadParameters(Operation op) throws KettleStepException {
    Input input = op.getInput();
    if (input != null) {
        Message in = input.getMessage();
        List<Object> paramOrdering = op.getParameterOrdering();
        List<Part> inParts = in.getOrderedParts(paramOrdering);
        for (Part part : inParts) {
            _params.add(part, true);
        }
    }
    Output output = op.getOutput();
    if (output != null) {
        Message out = output.getMessage();
        List<Part> outParts = out.getOrderedParts(null);
        for (Part part : outParts) {
            _oneway = false;
            _params.add(part, false);
        }
    }
}
Also used : Input(javax.wsdl.Input) Message(javax.wsdl.Message) Part(javax.wsdl.Part) Output(javax.wsdl.Output)

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