Search in sources :

Example 1 with SOAPOperation

use of javax.wsdl.extensions.soap.SOAPOperation 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 SOAPOperation

use of javax.wsdl.extensions.soap.SOAPOperation in project cxf by apache.

the class SOAPBindingUtil method isMixedStyle.

public static boolean isMixedStyle(Binding binding) {
    String bindingStyle = "";
    String previousOpStyle = "";
    String style = "";
    for (Object obj : binding.getExtensibilityElements()) {
        if (isSOAPBinding(obj)) {
            SOAPBinding soapBinding = getSoapBinding(obj);
            bindingStyle = soapBinding.getStyle();
            if (bindingStyle == null) {
                bindingStyle = "";
            }
        }
    }
    for (Object bobj : binding.getBindingOperations()) {
        BindingOperation bop = (BindingOperation) bobj;
        for (Object obj : bop.getExtensibilityElements()) {
            if (isSOAPOperation(obj)) {
                SOAPOperation soapOperation = getSoapOperation(obj);
                style = soapOperation.getStyle();
                if (style == null) {
                    style = "";
                }
                if ("".equals(bindingStyle) && "".equals(previousOpStyle) || "".equals(bindingStyle) && previousOpStyle.equalsIgnoreCase(style)) {
                    previousOpStyle = style;
                } else if (!"".equals(bindingStyle) && "".equals(previousOpStyle) && bindingStyle.equalsIgnoreCase(style) || bindingStyle.equalsIgnoreCase(previousOpStyle) && bindingStyle.equalsIgnoreCase(style)) {
                    previousOpStyle = style;
                } else if (!"".equals(bindingStyle) && "".equals(style) && "".equals(previousOpStyle)) {
                    continue;
                } else {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : BindingOperation(javax.wsdl.BindingOperation) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding)

Example 3 with SOAPOperation

use of javax.wsdl.extensions.soap.SOAPOperation 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)

Example 4 with SOAPOperation

use of javax.wsdl.extensions.soap.SOAPOperation in project tdi-studio-se by Talend.

the class ComponentBuilder method buildOperations.

private List buildOperations(Binding binding) {
    List operationInfos = new ArrayList();
    List operations = binding.getBindingOperations();
    if (operations != null && !operations.isEmpty()) {
        Vector soapBindingElems = findExtensibilityElement(binding.getExtensibilityElements(), "binding");
        // default
        String style = "document";
        ExtensibilityElement soapBindingElem = (ExtensibilityElement) soapBindingElems.elementAt(0);
        if (soapBindingElem != null && soapBindingElem instanceof SOAPBinding) {
            SOAPBinding soapBinding = (SOAPBinding) soapBindingElem;
            style = soapBinding.getStyle();
        } else if (soapBindingElem != null && soapBindingElem instanceof SOAP12Binding) {
            SOAP12Binding soapBinding = (SOAP12Binding) soapBindingElem;
            style = soapBinding.getStyle();
        }
        Iterator opIter = operations.iterator();
        while (opIter.hasNext()) {
            alldExtendtion.clear();
            BindingOperation oper = (BindingOperation) opIter.next();
            Vector operElems = findExtensibilityElement(oper.getExtensibilityElements(), "operation");
            ExtensibilityElement operElem = (ExtensibilityElement) operElems.elementAt(0);
            if (operElem != null && operElem instanceof SOAPOperation) {
                OperationInfo operationInfo = new OperationInfo(style);
                buildOperation(operationInfo, oper);
                operationInfos.add(operationInfo);
            } else if (operElem != null && operElem instanceof SOAP12Operation) {
                OperationInfo operationInfo = new OperationInfo(style);
                buildOperation(operationInfo, oper);
                operationInfos.add(operationInfo);
            }
        }
    }
    return operationInfos;
}
Also used : OperationInfo(org.talend.designer.webservice.ws.wsdlinfo.OperationInfo) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) BindingOperation(javax.wsdl.BindingOperation) SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation) SOAP12Operation(javax.wsdl.extensions.soap12.SOAP12Operation) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) List(java.util.List) ArrayList(java.util.ArrayList) Vector(java.util.Vector) UnknownExtensibilityElement(javax.wsdl.extensions.UnknownExtensibilityElement) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 5 with SOAPOperation

use of javax.wsdl.extensions.soap.SOAPOperation in project cxf by apache.

the class PartialWSDLProcessor method setSoapOperationExtElement.

private static void setSoapOperationExtElement(BindingOperation bo, ExtensionRegistry extReg) throws Exception {
    SOAPOperation soapOperation = SOAPBindingUtil.createSoapOperation(extReg, false);
    soapOperation.setStyle(style);
    soapOperation.setSoapActionURI("");
    bo.addExtensibilityElement(soapOperation);
}
Also used : SOAPOperation(javax.wsdl.extensions.soap.SOAPOperation)

Aggregations

SOAPOperation (javax.wsdl.extensions.soap.SOAPOperation)8 BindingOperation (javax.wsdl.BindingOperation)7 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)4 SOAP12Operation (javax.wsdl.extensions.soap12.SOAP12Operation)4 Binding (javax.wsdl.Binding)3 BindingInput (javax.wsdl.BindingInput)3 Input (javax.wsdl.Input)3 Message (javax.wsdl.Message)3 Operation (javax.wsdl.Operation)3 Output (javax.wsdl.Output)3 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)3 SOAPBody (javax.wsdl.extensions.soap.SOAPBody)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Vector (java.util.Vector)2 BindingOutput (javax.wsdl.BindingOutput)2 Port (javax.wsdl.Port)2 UnknownExtensibilityElement (javax.wsdl.extensions.UnknownExtensibilityElement)2 SOAPAddress (javax.wsdl.extensions.soap.SOAPAddress)2 SOAP12Binding (javax.wsdl.extensions.soap12.SOAP12Binding)2