Class DSMLv2SOAPConnector

  • All Implemented Interfaces:
    ConnectorInterface, VersionInfoInterface

    public class DSMLv2SOAPConnector
    extends Connector
    implements ConnectorInterface
    The DSMLv2 SOAP Connector implements the DSMLv2 standard (http://www.oasis-open.org/committees/dsml/docs/DSMLv2.doc). It is able to execute DSMLv2 requests against a DSML Server. It also provides the option to use DSML SOAP binding.
    • Field Detail

      • PARAMETER_URL

        public static final java.lang.String PARAMETER_URL
        A parameter name: "url"
        See Also:
        Constant Field Values
      • PARAMETER_AUTH_METHOD

        public static final java.lang.String PARAMETER_AUTH_METHOD
        A parameter name: "authenticationMethod"
        See Also:
        Constant Field Values
      • PARAMETER_USERNAME

        public static final java.lang.String PARAMETER_USERNAME
        A parameter name: "username"
        See Also:
        Constant Field Values
      • PARAMETER_PASSWORD

        public static final java.lang.String PARAMETER_PASSWORD
        A parameter name: "password"
        See Also:
        Constant Field Values
      • PARAMETER_BINARY_ATTRIBUTES

        public static final java.lang.String PARAMETER_BINARY_ATTRIBUTES
        A parameter name: "binaryAttributes"
        See Also:
        Constant Field Values
      • PARAMETER_SEARCH_BASE

        public static final java.lang.String PARAMETER_SEARCH_BASE
        A parameter name: "searchBase"
        See Also:
        Constant Field Values
      • PARAMETER_SEARCH_FILTER

        public static final java.lang.String PARAMETER_SEARCH_FILTER
        A parameter name: "searchFilter"
        See Also:
        Constant Field Values
      • PARAMETER_SEARCH_SCOPE

        public static final java.lang.String PARAMETER_SEARCH_SCOPE
        A parameter name: "searchScope"
        See Also:
        Constant Field Values
      • PARAMETER_SOAPBINDING

        public static final java.lang.String PARAMETER_SOAPBINDING
        A parameter name: "soapbinding"
        See Also:
        Constant Field Values
      • PARAMETER_SOAPACTION

        public static final java.lang.String PARAMETER_SOAPACTION
        A parameter name: "soapAction"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_SOAPACTION

        public static final java.lang.String ATTR_NAME_HTTP_SOAPACTION
        An attribute name: "http.SOAPAction"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_URL

        public static final java.lang.String ATTR_NAME_HTTP_URL
        An attribute name: "http.url"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_METHOD

        public static final java.lang.String ATTR_NAME_HTTP_METHOD
        An attribute name: "http.method"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_REMOTE_USER

        public static final java.lang.String ATTR_NAME_HTTP_REMOTE_USER
        An attribute name: "http.remote_user"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_REMOTE_PASSWORD

        public static final java.lang.String ATTR_NAME_HTTP_REMOTE_PASSWORD
        An attribute name: "http.remote_pass"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_BODY

        public static final java.lang.String ATTR_NAME_HTTP_BODY
        An attribute name: "http.body"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_CONTENT_TYPE

        public static final java.lang.String ATTR_NAME_HTTP_CONTENT_TYPE
        An attribute name: "http.Content-Type"
        See Also:
        Constant Field Values
      • ATTR_NAME_HTTP_CHARACTER_SET

        public static final java.lang.String ATTR_NAME_HTTP_CHARACTER_SET
        An attribute name: "characterSet"
        See Also:
        Constant Field Values
      • HTTP_BASIC_AUTH

        public static final java.lang.String HTTP_BASIC_AUTH
        String constant.
        See Also:
        Constant Field Values
      • BASE_OBJECT

        public static final java.lang.String BASE_OBJECT
        IBM TDS DSMLv2 String constant.
        See Also:
        Constant Field Values
      • SINGLE_LEVEL

        public static final java.lang.String SINGLE_LEVEL
        IBM TDS DSMLv2 String constant.
        See Also:
        Constant Field Values
      • WHOLE_SUBTREE

        public static final java.lang.String WHOLE_SUBTREE
        IBM TDS DSMLv2 String constant.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DSMLv2SOAPConnector

        public DSMLv2SOAPConnector()
        Default constructor. Instantiates the internally used DSMLv2 Parser and HTTP Parser.
    • Method Detail

      • initialize

        public void initialize​(java.lang.Object o)
                        throws java.lang.Exception
        Initializes the connector. Parses all the configuration parameters.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        o - - ignored
        Throws:
        java.lang.Exception - if the "url" parameter is missing or the protocol used is neither "http" nor "https".
      • putEntry

        public void putEntry​(Entry aPutEntry)
                      throws java.lang.Exception
        Sends the DSML request to the DSML Server. The entry is first parsed. If the server response indicates that an error has occurred then an exception with that error will be thrown.
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        aPutEntry - the DSML request as an Entry object, used by the DSMLv2Parser.
        Throws:
        java.lang.Exception - if the distinguish parameter is missing or the DSML Server replied with an error code.
      • queryReply

        public Entry queryReply​(Entry aQueryEntry)
                         throws java.lang.Exception
        Sends the DSML request to the DSML Server. The entry is first parsed. If the server response indicates that an error has occurred then an exception with that error will be thrown. If the response is not an error then that response is parsed back as an Entry object.
        Specified by:
        queryReply in interface ConnectorInterface
        Overrides:
        queryReply in class Connector
        Parameters:
        aQueryEntry - the DSML request as an Entry object, used by the DSMLv2Parser.
        Returns:
        the DSML response as an Entry object, used by the DSMLv2Parser.
        Throws:
        java.lang.Exception - if the DSML Server replied with an error code.
      • selectEntries

        public void selectEntries()
                           throws java.lang.Exception
        Initializes the connection with the server and sends a request based on the configured parameters. This operation prepares the result set so the getNextEntry() could return single entry at a time.
        Specified by:
        selectEntries in interface ConnectorInterface
        Overrides:
        selectEntries in class Connector
        Throws:
        java.lang.Exception - if the server responded with an error message.
      • findEntry

        public Entry findEntry​(SearchCriteria aSearch)
                        throws java.lang.Exception
        Finds an existing entry. The search criteria specifies which entry to locate

        Here is an example of how to find all people with names starting with 'J' which are from IBM organization in US.

        Example:

         var ctor = input.getConnector();
         var crit = new com.ibm.di.SearchCriteria("$dn",
                        com.ibm.di.SearchCriteria.SUBSTRING, "c=US,o=IBM");
         crit.addCriteria("name", com.ibm.di.SearchCriteria.INITIAL_STRING, "J");
         crit.addCriteria("objectclass", com.ibm.di.SearchCriteria.SUBSTRING, "person");
         
         var res = ctor.findEntry(crit);
         if (res != null) {
                main.logmsg("Found entry:");
                main.dumpEntry(res);
         } else {
          if( getFindEntryCount()> 1 ){
           main.logmsg("Found these entries:");
           while ( (entry = ctor.getNextFindEntry()) != null ) {
             main.dumpEntry(entry);
           }
          }
          else {
                 main.logmsg("Entry not found!");
          }
         }
         
        Specified by:
        findEntry in interface ConnectorInterface
        Overrides:
        findEntry in class Connector
        Parameters:
        aSearch - The search criteria used to locate the entry to be modified
        Returns:
        The entry found, or null if no or multiple entries found
        Throws:
        java.lang.Exception - if an error occurs.
      • modEntry

        public void modEntry​(Entry entry,
                             SearchCriteria search)
                      throws java.lang.Exception
        Modifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.
        Specified by:
        modEntry in interface ConnectorInterface
        Overrides:
        modEntry in class Connector
        Parameters:
        entry - The entry data
        search - The search criteria used to locate the entry to be modified
        Throws:
        java.lang.Exception - if an error occurs.
      • modEntry

        public void modEntry​(Entry entry,
                             SearchCriteria search,
                             Entry old)
                      throws java.lang.Exception
        Modifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.
        Specified by:
        modEntry in interface ConnectorInterface
        Overrides:
        modEntry in class Connector
        Parameters:
        entry - The entry data
        search - The search criteria used to locate the entry to be modified
        old - The old entry found by the search criteria
        Throws:
        java.lang.Exception - if an error occurs.
      • deleteEntry

        public void deleteEntry​(Entry aEntry,
                                SearchCriteria aSearch)
                         throws java.lang.Exception
        This method first look for an attribute with name Dsmlv2Parser.ATTR_NAME_DN in the provided entry if not found it looks the first criteria in the SearchCriteria object for the same name. If not found an exception is thrown. After the distinguished name is found the entry is parsed as a DSMLv2 request and sent. If the returned response indicates that an error had occurred then an exception is thrown.
        Specified by:
        deleteEntry in interface ConnectorInterface
        Overrides:
        deleteEntry in class Connector
        Parameters:
        aEntry - the entry which is the result of the attribute mapping
        aSearch - the search criteria object.
        Throws:
        java.lang.Exception - if an error while deleting the entry has occurred.
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Specified by:
        getVersion in interface VersionInfoInterface
        Returns:
        version information.