Search in sources :

Example 1 with SOAP12BodyImpl

use of com.ibm.wsdl.extensions.soap12.SOAP12BodyImpl in project pentaho-kettle by pentaho.

the class WsdlUtils method getSOAPBindingUse.

/**
 * Get the SOAP Use type for the specified operation.
 *
 * @param binding
 *          A WSDL Binding instance.
 * @param operationName
 *          The name of the operation.
 * @return Either 'literal' or 'encoded'.
 * @throws RuntimeException
 *           If the use type cannot be determined.
 */
protected static String getSOAPBindingUse(Binding binding, String operationName) {
    BindingOperation bindingOperation = binding.getBindingOperation(operationName, null, null);
    if (bindingOperation == null) {
        throw new IllegalArgumentException("Can not find operation: " + operationName);
    }
    // first try getting the use setting from the input message
    BindingInput bindingInput = bindingOperation.getBindingInput();
    if (bindingInput != null) {
        ExtensibilityElement soapBodyElem = WsdlUtils.findExtensibilityElement(bindingInput, SOAP_BODY_ELEMENT_NAME);
        if (soapBodyElem != null) {
            if (soapBodyElem instanceof SOAP12BodyImpl) {
                return ((SOAP12BodyImpl) soapBodyElem).getUse();
            } else {
                return ((SOAPBody) soapBodyElem).getUse();
            }
        }
    }
    // if there was no input message try getting the use from the output message
    BindingOutput bindingOutput = bindingOperation.getBindingOutput();
    if (bindingOutput != null) {
        ExtensibilityElement soapBodyElem = WsdlUtils.findExtensibilityElement(bindingOutput, SOAP_BODY_ELEMENT_NAME);
        if (soapBodyElem != null) {
            if (soapBodyElem instanceof SOAP12BodyImpl) {
                return ((SOAP12BodyImpl) soapBodyElem).getUse();
            } else {
                return ((SOAPBody) soapBodyElem).getUse();
            }
        }
    }
    throw new RuntimeException("Unable to determine SOAP use for operation: " + operationName);
}
Also used : BindingOperation(javax.wsdl.BindingOperation) SOAPBody(javax.wsdl.extensions.soap.SOAPBody) BindingOutput(javax.wsdl.BindingOutput) SOAP12BodyImpl(com.ibm.wsdl.extensions.soap12.SOAP12BodyImpl) BindingInput(javax.wsdl.BindingInput) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Aggregations

SOAP12BodyImpl (com.ibm.wsdl.extensions.soap12.SOAP12BodyImpl)1 BindingInput (javax.wsdl.BindingInput)1 BindingOperation (javax.wsdl.BindingOperation)1 BindingOutput (javax.wsdl.BindingOutput)1 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)1 SOAPBody (javax.wsdl.extensions.soap.SOAPBody)1