Search in sources :

Example 1 with Input

use of javax.wsdl.Input 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 Input

use of javax.wsdl.Input in project Lucee by lucee.

the class JaxWSClient method toDumpData.

private DumpData toDumpData(BindingOperation bo) {
    Map<QName, Message> messages = wsdl.getMessages();
    DumpTable table = new DumpTable("#99cc99", "#ccffcc", "#000000");
    DumpTable attributes = new DumpTable("#99cc99", "#ccffcc", "#000000");
    String returns = "void";
    attributes.appendRow(3, new SimpleDumpData("name"), new SimpleDumpData("type"));
    Operation op = bo.getOperation();
    // attributes
    Input in = op.getInput();
    Message msg = in.getMessage();
    // msg=WSUtil.getMessageByLocalName(messages,bo.getBindingInput().getName());
    // print.e(msg.getQName());
    List<Part> parts = msg.getOrderedParts(null);
    Iterator<Part> it = parts.iterator();
    Part p;
    QName en;
    QName type;
    while (it.hasNext()) {
        p = it.next();
        en = p.getElementName();
        if (en != null) {
            type = en;
            Types types = wsdl.getTypes();
        } else
            type = p.getTypeName();
        attributes.appendRow(0, new SimpleDumpData(en + ":" + p.getName()), new SimpleDumpData(toLuceeType(type)));
    }
    // return
    msg = bo.getOperation().getOutput().getMessage();
    msg = wsdl.getMessage(msg.getQName());
    parts = msg.getOrderedParts(null);
    it = parts.iterator();
    while (it.hasNext()) {
        p = it.next();
        returns = toLuceeType(p.getTypeName());
    }
    table.appendRow(1, new SimpleDumpData("arguments"), attributes);
    table.appendRow(1, new SimpleDumpData("return type"), new SimpleDumpData(returns));
    return table;
}
Also used : DumpTable(lucee.runtime.dump.DumpTable) Types(javax.wsdl.Types) Input(javax.wsdl.Input) Message(javax.wsdl.Message) QName(javax.xml.namespace.QName) Part(javax.wsdl.Part) SimpleDumpData(lucee.runtime.dump.SimpleDumpData) Operation(javax.wsdl.Operation) BindingOperation(javax.wsdl.BindingOperation)

Example 3 with Input

use of javax.wsdl.Input in project carbon-apimgt by wso2.

the class WSDL11ProcessorImpl method getParameters.

/**
 * Returns parameters, given http binding operation, verb and content type
 *
 * @param bindingOperation {@link BindingOperation} object
 * @param verb             HTTP verb
 * @param contentType      Content type
 * @return parameters, given http binding operation, verb and content type
 */
private List<WSDLOperationParam> getParameters(BindingOperation bindingOperation, String verb, String contentType) {
    List<WSDLOperationParam> params = new ArrayList<>();
    Operation operation = bindingOperation.getOperation();
    // or content type is not provided
    if (APIMWSDLUtils.canContainBody(verb) && !APIMWSDLUtils.hasFormDataParams(contentType)) {
        WSDLOperationParam param = new WSDLOperationParam();
        param.setName("Payload");
        param.setParamType(WSDLOperationParam.ParamTypeEnum.BODY);
        params.add(param);
        if (log.isDebugEnabled()) {
            log.debug("Adding default Param for operation:" + operation.getName() + ", contentType: " + contentType);
        }
        return params;
    }
    if (operation != null) {
        Input input = operation.getInput();
        if (input != null) {
            Message message = input.getMessage();
            if (message != null) {
                Map map = message.getParts();
                map.forEach((name, partObj) -> {
                    WSDLOperationParam param = new WSDLOperationParam();
                    param.setName(name.toString());
                    if (log.isDebugEnabled()) {
                        log.debug("Identified param for operation: " + operation.getName() + " param: " + name);
                    }
                    if (APIMWSDLUtils.canContainBody(verb)) {
                        if (log.isDebugEnabled()) {
                            log.debug("Operation " + operation.getName() + " can contain a body.");
                        }
                        // In POST, PUT operations, parameters always in body according to HTTP Binding spec
                        if (APIMWSDLUtils.hasFormDataParams(contentType)) {
                            param.setParamType(WSDLOperationParam.ParamTypeEnum.FORM_DATA);
                            if (log.isDebugEnabled()) {
                                log.debug("Param " + name + " type was set to formData.");
                            }
                        }
                    // no else block since if content type is not form-data related, there can be only one
                    // parameter which is payload body. This is handled in the first if block which is
                    // if (canContainBody(verb) && !hasFormDataParams(contentType)) { .. }
                    } else {
                        // In GET operations, parameters always query or path as per HTTP Binding spec
                        if (isUrlReplacement(bindingOperation)) {
                            param.setParamType(WSDLOperationParam.ParamTypeEnum.PATH);
                            if (log.isDebugEnabled()) {
                                log.debug("Param " + name + " type was set to Path.");
                            }
                        } else {
                            param.setParamType(WSDLOperationParam.ParamTypeEnum.QUERY);
                            if (log.isDebugEnabled()) {
                                log.debug("Param " + name + " type was set to Query.");
                            }
                        }
                    }
                    Part part = (Part) partObj;
                    param.setDataType(part.getTypeName().getLocalPart());
                    if (log.isDebugEnabled()) {
                        log.debug("Param " + name + " data type was set to " + param.getDataType());
                    }
                    params.add(param);
                });
            }
        }
    }
    return params;
}
Also used : WSDLOperationParam(org.wso2.carbon.apimgt.core.models.WSDLOperationParam) Input(javax.wsdl.Input) BindingInput(javax.wsdl.BindingInput) Message(javax.wsdl.Message) Part(javax.wsdl.Part) ArrayList(java.util.ArrayList) Operation(javax.wsdl.Operation) HTTPOperation(javax.wsdl.extensions.http.HTTPOperation) BindingOperation(javax.wsdl.BindingOperation) WSDLOperation(org.wso2.carbon.apimgt.core.models.WSDLOperation) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with Input

use of javax.wsdl.Input in project carbon-business-process by wso2.

the class AxisServiceUtils method getWSAInputAction.

/**
 * Attempts to extract the WS-Addressing "Action" attribute value from the operation definition.
 * When WS-Addressing is being used by a service provider, the "Action" is specified in the
 * portType->operation instead of the SOAP binding->operation.
 *
 * @param partnerMessageContext BPELMessageContext
 * @return the SOAPAction value if one is specified, otherwise empty string
 */
public static String getWSAInputAction(BPELMessageContext partnerMessageContext) {
    BindingOperation bop = partnerMessageContext.getWsdlBindingForCurrentMessageFlow().getBindingOperation(partnerMessageContext.getOperationName(), null, null);
    if (bop == null) {
        return "";
    }
    Input input = bop.getOperation().getInput();
    if (input != null) {
        Object action = input.getExtensionAttribute(new QName(Namespaces.WS_ADDRESSING_NS, "Action"));
        if (action instanceof String) {
            return ((String) action);
        }
        action = input.getExtensionAttribute(new QName(BPELConstants.WS_ADDRESSING_NS2, "Action"));
        if (action instanceof String) {
            return ((String) action);
        }
        action = input.getExtensionAttribute(new QName(BPELConstants.WS_ADDRESSING_NS3, "Action"));
        if (action instanceof String) {
            return ((String) action);
        }
        action = input.getExtensionAttribute(new QName(BPELConstants.WS_ADDRESSING_NS4, "Action"));
        if (action instanceof String) {
            return ((String) action);
        }
    }
    return "";
}
Also used : BindingOperation(javax.wsdl.BindingOperation) Input(javax.wsdl.Input) QName(javax.xml.namespace.QName)

Example 5 with Input

use of javax.wsdl.Input in project teiid by teiid.

the class WSDLMetadataProcessor method buildSoapOperation.

private void buildSoapOperation(MetadataFactory mf, BindingOperation bindingOperation) {
    Operation operation = bindingOperation.getOperation();
    // add input
    String inputXML = null;
    Input input = operation.getInput();
    if (input != null) {
        Message message = input.getMessage();
        if (message != null) {
            inputXML = message.getQName().getLocalPart();
        }
    }
    // add output
    String outXML = null;
    Output output = operation.getOutput();
    if (output != null) {
        Message message = output.getMessage();
        if (message != null) {
            outXML = message.getQName().getLocalPart();
        }
    }
    // $NON-NLS-1$
    ExtensibilityElement operationExtension = getExtensibilityElement(bindingOperation.getExtensibilityElements(), "operation");
    if (!(operationExtension instanceof SOAPOperation) && !(operationExtension instanceof SOAP12Operation)) {
        return;
    }
    if (operationExtension instanceof SOAPOperation) {
        // soap:operation
        SOAPOperation soapOperation = (SOAPOperation) operationExtension;
        String style = soapOperation.getStyle();
        if (style.equalsIgnoreCase("rpc")) {
            // $NON-NLS-1$
            LogManager.logInfo(LogConstants.CTX_CONNECTOR, WSExecutionFactory.UTIL.gs(WSExecutionFactory.Event.TEIID15004, operation.getName()));
            return;
        }
    } else if (operationExtension instanceof SOAP12Operation) {
        // soap:operation
        SOAP12Operation soapOperation = (SOAP12Operation) operationExtension;
        String style = soapOperation.getStyle();
        if (style.equalsIgnoreCase("rpc")) {
            // $NON-NLS-1$
            LogManager.logInfo(LogConstants.CTX_CONNECTOR, WSExecutionFactory.UTIL.gs(WSExecutionFactory.Event.TEIID15004, operation.getName()));
            return;
        }
    }
    Procedure procedure = mf.addProcedure(operation.getName());
    procedure.setVirtual(false);
    procedure.setNameInSource(operation.getName());
    mf.addProcedureParameter(inputXML, TypeFacility.RUNTIME_NAMES.XML, Type.In, procedure);
    // $NON-NLS-1$
    ProcedureParameter param = mf.addProcedureParameter("stream", TypeFacility.RUNTIME_NAMES.BOOLEAN, Type.In, procedure);
    // $NON-NLS-1$
    param.setAnnotation("If the result should be streamed.");
    param.setNullType(NullType.Nullable);
    // $NON-NLS-1$
    param.setDefaultValue("false");
    mf.addProcedureParameter(outXML, TypeFacility.RUNTIME_NAMES.XML, Type.ReturnValue, procedure);
}
Also used : ProcedureParameter(org.teiid.metadata.ProcedureParameter) Input(javax.wsdl.Input) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) Message(javax.wsdl.Message) Output(javax.wsdl.Output) Procedure(org.teiid.metadata.Procedure) Operation(javax.wsdl.Operation) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) BindingOperation(javax.wsdl.BindingOperation) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Aggregations

Input (javax.wsdl.Input)25 Message (javax.wsdl.Message)20 Operation (javax.wsdl.Operation)18 BindingOperation (javax.wsdl.BindingOperation)15 Output (javax.wsdl.Output)15 QName (javax.xml.namespace.QName)13 Part (javax.wsdl.Part)12 BindingInput (javax.wsdl.BindingInput)8 Map (java.util.Map)7 BindingOutput (javax.wsdl.BindingOutput)6 Fault (javax.wsdl.Fault)6 PortType (javax.wsdl.PortType)6 SOAPOperation (javax.wsdl.extensions.soap.SOAPOperation)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 SOAP12Operation (javax.wsdl.extensions.soap12.SOAP12Operation)5 Binding (javax.wsdl.Binding)4 Test (org.junit.Test)4 Collection (java.util.Collection)3 BindingFault (javax.wsdl.BindingFault)3