javax.wsdl.extensions.ElementExtensible Java Examples

The following examples show how to use javax.wsdl.extensions.ElementExtensible. 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: WsdlTypes.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Get the schema with the specified target namespace.
 *
 * @param targetNamespace target namespace of the schema to get.
 * @return null if not found.
 */
private Schema getSchema( String targetNamespace ) {

  if ( _types == null ) {
    return null;
  }

  List<ExtensibilityElement> schemas = WsdlUtils.findExtensibilityElements( (ElementExtensible) _types, "schema" );

  for ( ExtensibilityElement e : schemas ) {
    Element schemaRoot = ( (Schema) e ).getElement();
    String tns = schemaRoot.getAttribute( "targetNamespace" );
    if ( targetNamespace.equals( tns ) ) {
      return (Schema) e;
    }
  }
  return null;
}
 
Example #2
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 #3
Source File: WsdlUtils.java    From hop with Apache License 2.0 6 votes vote down vote up
/**
 * Find all of the extensibility elements with the specified name.
 *
 * @param extensibleElement WSDL type which extends ElementExtensible.
 * @param elementType       Name of the extensibility element to find.
 * @return List of ExtensibilityElements, may be empty.
 */
@SuppressWarnings( "unchecked" )
protected static List<ExtensibilityElement> findExtensibilityElements( ElementExtensible extensibleElement,
                                                                       String elementType ) {

  List<ExtensibilityElement> elements = new ArrayList<ExtensibilityElement>();
  List<ExtensibilityElement> extensibilityElements = extensibleElement.getExtensibilityElements();

  if ( extensibilityElements != null ) {
    for ( ExtensibilityElement element : extensibilityElements ) {
      if ( element.getElementType().getLocalPart().equalsIgnoreCase( elementType ) ) {
        elements.add( element );
      }
    }
  }
  return elements;
}
 
Example #4
Source File: ServiceWSDLBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void addExtensibilityElements(Definition def,
                                        ElementExtensible elementExtensible,
                                        List<ExtensibilityElement> extensibilityElements) {
    if (extensibilityElements != null) {
        for (ExtensibilityElement element : extensibilityElements) {
            if (element instanceof UnknownExtensibilityElement) {
                UnknownExtensibilityElement uee = (UnknownExtensibilityElement)element;
                String pfx = uee.getElement().getPrefix();
                addNamespace(pfx, element.getElementType().getNamespaceURI(), def);
            } else {
                QName qn = element.getElementType();
                addNamespace(qn.getNamespaceURI(), def);
            }
            elementExtensible.addExtensibilityElement(element);
        }
    }
}
 
Example #5
Source File: WsdlUtils.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Find all of the extensibility elements with the specified name.
 *
 * @param extensibleElement
 *          WSDL type which extends ElementExtensible.
 * @param elementType
 *          Name of the extensibility element to find.
 * @return List of ExtensibilityElements, may be empty.
 */
@SuppressWarnings( "unchecked" )
protected static List<ExtensibilityElement> findExtensibilityElements( ElementExtensible extensibleElement,
  String elementType ) {

  List<ExtensibilityElement> elements = new ArrayList<ExtensibilityElement>();
  List<ExtensibilityElement> extensibilityElements = extensibleElement.getExtensibilityElements();

  if ( extensibilityElements != null ) {
    for ( ExtensibilityElement element : extensibilityElements ) {
      if ( element.getElementType().getLocalPart().equalsIgnoreCase( elementType ) ) {
        elements.add( element );
      }
    }
  }
  return elements;
}
 
Example #6
Source File: WsdlTypes.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Return a list of of all schemas defined by the WSDL definition.
 *
 * @return A list of javax.wsdl.extension.schema.Schema elements.
 */
protected List<ExtensibilityElement> getSchemas() {
  if ( _types == null ) {
    return Collections.emptyList();
  }
  return WsdlUtils.findExtensibilityElements( (ElementExtensible) _types, WsdlUtils.SCHEMA_ELEMENT_NAME );
}
 
Example #7
Source File: WsdlUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Get the SOAP address location for the specified port.
 *
 * @param p A WSDL Port instance.
 * @return The SOAP address URI.
 */
protected static String getSOAPAddress( Port p ) {
  ExtensibilityElement e = findExtensibilityElement( (ElementExtensible) p, SOAP_PORT_ADDRESS_NAME );
  if ( e instanceof SOAP12Address ) {
    return ( (SOAP12Address) e ).getLocationURI();
  } else if ( e instanceof SOAPAddress ) {
    return ( (SOAPAddress) e ).getLocationURI();
  }

  return null;
}
 
Example #8
Source File: WsdlUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Get the Soap Action URI from the operation's soap:operation extensiblity element.
 *
 * @param operation A WSDL Operation.
 * @return Soap action URI as string, null if not defined.
 */
protected static String getSOAPAction( BindingOperation operation ) {
  ExtensibilityElement e = findExtensibilityElement( (ElementExtensible) operation, SOAP_OPERATION_ELEMENT_NAME );
  if ( e != null ) {
    if ( e instanceof SOAP12Operation ) {
      return ( (SOAP12Operation) e ).getSoapActionURI();
    } else {
      return ( (SOAPOperation) e ).getSoapActionURI();
    }
  }
  return null;
}
 
Example #9
Source File: WsdlUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Build a HashSet of SOAP header names for the specified operation and binding.
 *
 * @param binding       WSDL Binding instance.
 * @param operationName Name of the operation.
 * @return HashSet of soap header names, empty set if no headers present.
 */
protected static HashSet<String> getSOAPHeaders( Binding binding, String operationName ) {

  List<ExtensibilityElement> headers = new ArrayList<ExtensibilityElement>();
  BindingOperation bindingOperation = binding.getBindingOperation( operationName, null, null );
  if ( bindingOperation == null ) {
    throw new IllegalArgumentException( "Can not find operation: " + operationName );
  }

  BindingInput bindingInput = bindingOperation.getBindingInput();
  if ( bindingInput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( (ElementExtensible) bindingInput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  BindingOutput bindingOutput = bindingOperation.getBindingOutput();
  if ( bindingOutput != null ) {
    headers.addAll( WsdlUtils.findExtensibilityElements( (ElementExtensible) bindingOutput, SOAP_HEADER_ELEMENT_NAME ) );
  }

  HashSet<String> headerSet = new HashSet<String>( headers.size() );
  for ( ExtensibilityElement element : headers ) {
    if ( element instanceof SOAP12Header ) {
      headerSet.add( ( (SOAP12Header) element ).getPart() );
    } else {
      headerSet.add( ( (SOAPHeader) element ).getPart() );
    }
  }

  return headerSet;
}
 
Example #10
Source File: WsdlUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Find the specified extensibility element, if more than one with the specified name exists in the list, return the
 * first one found.
 *
 * @param extensibleElement WSDL type which extends ElementExtensible.
 * @param elementType       Name of the extensiblity element to find.
 * @return ExtensibilityElement The ExtensiblityElement, if not found return null.
 */
@SuppressWarnings( "unchecked" )
protected static ExtensibilityElement findExtensibilityElement( ElementExtensible extensibleElement,
                                                                String elementType ) {

  List<ExtensibilityElement> extensibilityElements = extensibleElement.getExtensibilityElements();
  if ( extensibilityElements != null ) {
    for ( ExtensibilityElement element : extensibilityElements ) {
      if ( element.getElementType().getLocalPart().equalsIgnoreCase( elementType ) ) {
        return element;
      }
    }
  }
  return null;
}
 
Example #11
Source File: AbstractWSDLBindingFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void copyExtensors(AbstractPropertiesHolder info, ElementExtensible extElement,
                           BindingOperationInfo bop) {
    if (info != null) {
        for (ExtensibilityElement ext : cast(extElement.getExtensibilityElements(),
                                             ExtensibilityElement.class)) {
            info.addExtensor(ext);
            if (bop != null && extElement instanceof BindingInput) {
                addMessageFromBinding(ext, bop, true);
            }
            if (bop != null && extElement instanceof BindingOutput) {
                addMessageFromBinding(ext, bop, false);
            }
        }
    }
}
 
Example #12
Source File: WsdlUtils.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Find the specified extensibility element, if more than one with the specified name exists in the list, return the
 * first one found.
 *
 * @param extensibleElement
 *          WSDL type which extends ElementExtensible.
 * @param elementType
 *          Name of the extensiblity element to find.
 * @return ExtensibilityElement The ExtensiblityElement, if not found return null.
 */
@SuppressWarnings( "unchecked" )
protected static ExtensibilityElement findExtensibilityElement( ElementExtensible extensibleElement,
  String elementType ) {

  List<ExtensibilityElement> extensibilityElements = extensibleElement.getExtensibilityElements();
  if ( extensibilityElements != null ) {
    for ( ExtensibilityElement element : extensibilityElements ) {
      if ( element.getElementType().getLocalPart().equalsIgnoreCase( elementType ) ) {
        return element;
      }
    }
  }
  return null;
}