javax.wsdl.extensions.soap12.SOAP12Binding Java Examples

The following examples show how to use javax.wsdl.extensions.soap12.SOAP12Binding. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WsdlUtils.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Get the SOAPBinding style for the specified WSDL Port.
 *
 * @param binding A WSDL Binding instance.
 * @return String either 'document' or 'rpc', if not found in WSDL defaults to 'document'.
 */
protected static String getSOAPBindingStyle( Binding binding ) throws HopException {
  String style = SOAP_BINDING_DEFAULT;
  ExtensibilityElement soapBindingElem = findExtensibilityElement( (ElementExtensible) binding, SOAP_BINDING_ELEMENT_NAME );

  if ( soapBindingElem != null ) {
    if ( soapBindingElem instanceof SOAP12Binding ) {
      style = ( (SOAP12Binding) soapBindingElem ).getStyle();
    } else if ( soapBindingElem instanceof SOAPBinding ) {
      style = ( (SOAPBinding) soapBindingElem ).getStyle();
    } else {
      throw new HopException( "Binding type "
        + soapBindingElem + " encountered. The Web Service Lookup transform only supports SOAP Bindings!" );
    }
  }
  return style;
}
 
Example #2
Source File: WSDL11SOAPOperationExtractor.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * Retrieves all the operations defined in the provided Binding.
 *
 * @param binding WSDL binding
 * @return a set of {@link WSDLOperation} defined in the provided Binding
 */
private Set<WSDLSOAPOperation> getSOAPBindingOperations(Binding binding) throws APIMgtWSDLException {
    Set<WSDLSOAPOperation> allBindingOperations = new HashSet<>();
    if (binding.getExtensibilityElements() != null && binding.getExtensibilityElements().size() > 0) {
        List extensibilityElements = binding.getExtensibilityElements();
        for (Object extensibilityElement : extensibilityElements) {
            if (extensibilityElement instanceof SOAPBinding || extensibilityElement instanceof SOAP12Binding) {
                for (Object opObj : binding.getBindingOperations()) {
                    BindingOperation bindingOperation = (BindingOperation) opObj;
                    WSDLSOAPOperation wsdlSoapOperation = getSOAPOperation(bindingOperation);
                    if (wsdlSoapOperation != null) {
                        allBindingOperations.add(wsdlSoapOperation);
                    } else {
                        log.warn("Unable to get soap operation details from binding operation: " + bindingOperation
                                .getName());
                    }
                }
            }
        }
    } else {
        throw new APIMgtWSDLException("Cannot further process to get soap binding operations");
    }
    return allBindingOperations;
}
 
Example #3
Source File: WSDL11SOAPOperationExtractor.java    From carbon-apimgt with Apache License 2.0 6 votes vote down vote up
/**
 * Returns if the provided WSDL definition contains SOAP 1.2 binding operations
 *
 * @return whether the provided WSDL definition contains SOAP 1.2 binding operations
 */
private boolean hasSoap12BindingOperations() {
    if (wsdlDefinition == null) {
        return false;
    }
    for (Object bindingObj : wsdlDefinition.getAllBindings().values()) {
        if (bindingObj instanceof Binding) {
            Binding binding = (Binding) bindingObj;
            for (Object ex : binding.getExtensibilityElements()) {
                if (ex instanceof SOAP12Binding) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #4
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static SoapBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class,
                                                           new QName(WSDLConstants.NS_SOAP12,
                                                                     "binding"));
        ((SOAP12Binding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class,
                                                         new QName(WSDLConstants.NS_SOAP11,
                                                                   "binding"));
        ((SOAPBinding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
 
Example #5
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static SOAPBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12)
    throws WSDLException {
    ExtensibilityElement extElement = null;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class,
                                                           new QName(WSDLConstants.NS_SOAP12,
                                                                     "binding"));
        ((SOAP12Binding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class,
                                                         new QName(WSDLConstants.NS_SOAP11,
                                                                   "binding"));
        ((SOAPBinding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
 
Example #6
Source File: WsdlUtils.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Get the SOAPBinding style for the specified WSDL Port.
 *
 * @param binding
 *          A WSDL Binding instance.
 * @return String either 'document' or 'rpc', if not found in WSDL defaults to 'document'.
 */
protected static String getSOAPBindingStyle( Binding binding ) throws KettleException {
  String style = SOAP_BINDING_DEFAULT;
  ExtensibilityElement soapBindingElem = findExtensibilityElement( binding, SOAP_BINDING_ELEMENT_NAME );

  if ( soapBindingElem != null ) {
    if ( soapBindingElem instanceof SOAP12Binding ) {
      style = ( (SOAP12Binding) soapBindingElem ).getStyle();
    } else if ( soapBindingElem instanceof SOAPBinding ) {
      style = ( (SOAPBinding) soapBindingElem ).getStyle();
    } else {
      throw new KettleException( "Binding type "
        + soapBindingElem + " encountered. The Web Service Lookup step only supports SOAP Bindings!" );
    }
  }
  return style;
}
 
Example #7
Source File: SoapApiConnectorGenerator.java    From syndesis with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private Connector createConnector(ConnectorTemplate connectorTemplate, ConnectorSettings connectorSettings,
                                  SoapApiModelInfo modelInfo) {

    final Definition definition = modelInfo.getModel().
            orElseThrow(() -> new IllegalArgumentException("Unable to parse WSDL, or missing SOAP Service and Port in specification"));

    // get service and port
    final Map<String, String> configuredProperties = connectorSettings.getConfiguredProperties();
    final QName serviceName = getService(modelInfo, configuredProperties)
            .orElseThrow(() -> new IllegalArgumentException("Missing property " + SERVICE_NAME_PROPERTY));
    final String portName = getPortName(modelInfo, configuredProperties)
            .orElseThrow(() -> new IllegalArgumentException("Missing property " + PORT_NAME_PROPERTY));

    // get SOAP Version from Service and Port
    final Service service = definition.getService(serviceName);
    final Port port = service.getPort(portName);
    final Binding binding = port.getBinding();
    double soapVersion = 1.1;
    for (Object element : binding.getExtensibilityElements()) {
        if (element instanceof SOAP12Binding) {
            soapVersion = 1.2;
            break;
        }
    }

    // add actions
    try {

        final Connector configuredConnector = configuredConnector(connectorTemplate, connectorSettings);

        final List<ConnectorAction> actions = SoapApiModelParser.parseActions(definition,
                serviceName, new QName(serviceName.getNamespaceURI(), portName),
                configuredConnector.getId().get());
        final ActionsSummary actionsSummary = SoapApiModelParser.parseActionsSummary(definition, serviceName, portName);

        final Connector.Builder builder = new Connector.Builder()
                .createFrom(configuredConnector)
                .putConfiguredProperty(SOAP_VERSION_PROPERTY, String.valueOf(soapVersion))
                .addAllActions(actions)
                .actionsSummary(actionsSummary);

        return builder.build();

    } catch (ParserException e) {
        throw new IllegalArgumentException("Error getting actions from WSDL: " + e.getMessage(), e);
    }
}
 
Example #8
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPBinding(Object obj) {
    return obj instanceof SOAPBinding || obj instanceof SOAP12Binding;
}
 
Example #9
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPBinding(Object obj) {
    return obj instanceof SOAPBinding || obj instanceof SOAP12Binding;
}